Merge remote-tracking branch 'origin/develop' into akun
正在显示
6 个修改的文件
包含
65 行增加
和
9 行删除
app/Console/Commands/ImportChannel.php
0 → 100644
| 1 | +<?php | ||
| 2 | +/** | ||
| 3 | + * @remark : | ||
| 4 | + * @name :ImportChannel.php | ||
| 5 | + * @author :lyh | ||
| 6 | + * @method :post | ||
| 7 | + * @time :2023/9/25 15:31 | ||
| 8 | + */ | ||
| 9 | + | ||
| 10 | +namespace App\Console\Commands; | ||
| 11 | +use App\Helper\OaGlobalsoApi; | ||
| 12 | +use App\Models\Channel\Channel; | ||
| 13 | +use App\Models\Project\Project; | ||
| 14 | +use Illuminate\Console\Command; | ||
| 15 | +class ImportChannel extends Command | ||
| 16 | +{ | ||
| 17 | + /** | ||
| 18 | + * The name and signature of the console command. | ||
| 19 | + * | ||
| 20 | + * @var string | ||
| 21 | + */ | ||
| 22 | + protected $signature = 'import_channel'; | ||
| 23 | + | ||
| 24 | + /** | ||
| 25 | + * The console command description. | ||
| 26 | + * | ||
| 27 | + * @var string | ||
| 28 | + */ | ||
| 29 | + protected $description = '更新渠道信息'; | ||
| 30 | + | ||
| 31 | + /** | ||
| 32 | + * @remark :导入5.0管理员数据 | ||
| 33 | + * @name :handle | ||
| 34 | + * @author :lyh | ||
| 35 | + * @method :post | ||
| 36 | + * @time :2023/8/7 17:49 | ||
| 37 | + */ | ||
| 38 | + public function handle(){ | ||
| 39 | + $projectModel = new Project(); | ||
| 40 | + $map = [ | ||
| 41 | + 'channel'=>['like','%"user_id": "0"%'], | ||
| 42 | + ]; | ||
| 43 | + $lists = $projectModel->list($map); | ||
| 44 | +// var_dump($lists); | ||
| 45 | +// die(); | ||
| 46 | + foreach ($lists as $k => $v){ | ||
| 47 | + $order_id = $v['notice_order_id']; | ||
| 48 | + $api = new OaGlobalsoApi(); | ||
| 49 | + $data = $api->order_info($order_id); | ||
| 50 | + $data = $data['data']; | ||
| 51 | + $channel = Channel::getProjectChannel($data['company_id'], $data['username_sales']); | ||
| 52 | + $projectModel->edit(['channel'=>$channel],['id'=>$v['id']]); | ||
| 53 | + } | ||
| 54 | + return 1; | ||
| 55 | + } | ||
| 56 | +} |
| @@ -39,7 +39,7 @@ class BaseController extends Controller | @@ -39,7 +39,7 @@ class BaseController extends Controller | ||
| 39 | $info = Cache::get(Common::MANAGE_TOKEN . $this->token); | 39 | $info = Cache::get(Common::MANAGE_TOKEN . $this->token); |
| 40 | if(!empty($this->token) && !empty($info)){ | 40 | if(!empty($this->token) && !empty($info)){ |
| 41 | $this->manage = $info; | 41 | $this->manage = $info; |
| 42 | - Cache::put($this->token, $info, 3600 * 6);//更新缓存时间 | 42 | + Cache::put(Common::MANAGE_TOKEN . $this->token, $info, 3600 * 6);//更新缓存时间 |
| 43 | $this->uid = $info['id']; | 43 | $this->uid = $info['id']; |
| 44 | } | 44 | } |
| 45 | } | 45 | } |
| @@ -82,18 +82,18 @@ class LoginController extends BaseController | @@ -82,18 +82,18 @@ class LoginController extends BaseController | ||
| 82 | $mobile = $this->param['mobile']; | 82 | $mobile = $this->param['mobile']; |
| 83 | $manager = Manage::where(['mobile' => $mobile])->first(); | 83 | $manager = Manage::where(['mobile' => $mobile])->first(); |
| 84 | if (empty($manager)) { | 84 | if (empty($manager)) { |
| 85 | - $this->response('请输入正确的手机号码!', Code::USER_LOGIN_ERROE); | 85 | + $this->response('请输入正确的手机号码!', Code::SYSTEM_ERROR); |
| 86 | } | 86 | } |
| 87 | $last_sms = SmsLog::getLastLog($mobile, SmsLog::TYPE_MANAGER_LOGIN); | 87 | $last_sms = SmsLog::getLastLog($mobile, SmsLog::TYPE_MANAGER_LOGIN); |
| 88 | if ($last_sms && $last_sms->use = SmsLog::USE_USABLE && time() - strtotime($last_sms->created_at) < 60) { | 88 | if ($last_sms && $last_sms->use = SmsLog::USE_USABLE && time() - strtotime($last_sms->created_at) < 60) { |
| 89 | - $this->response('请不要重复发送短信!', Code::USER_LOGIN_ERROE); | 89 | + $this->response('请不要重复发送短信!', Code::SYSTEM_ERROR); |
| 90 | } | 90 | } |
| 91 | $template = config('aliyunsms.login_sms_temp'); | 91 | $template = config('aliyunsms.login_sms_temp'); |
| 92 | $code['code'] = rand(100000,999999); | 92 | $code['code'] = rand(100000,999999); |
| 93 | $ali_sms = new AliSms(); | 93 | $ali_sms = new AliSms(); |
| 94 | $send = $ali_sms->sendSms(strval($mobile), $template, $code); | 94 | $send = $ali_sms->sendSms(strval($mobile), $template, $code); |
| 95 | if (empty($send->Code) && $send->Code != 'OK') { | 95 | if (empty($send->Code) && $send->Code != 'OK') { |
| 96 | - $this->response('发送失败, 请稍后重试!', Code::USER_LOGIN_ERROE); | 96 | + $this->response('发送失败, 请稍后重试!', Code::SYSTEM_ERROR); |
| 97 | } | 97 | } |
| 98 | SmsLog::createLog($mobile, $code['code'],SmsLog::TYPE_MANAGER_LOGIN); | 98 | SmsLog::createLog($mobile, $code['code'],SmsLog::TYPE_MANAGER_LOGIN); |
| 99 | $this->response('success'); | 99 | $this->response('success'); |
| @@ -112,18 +112,18 @@ class LoginController extends BaseController | @@ -112,18 +112,18 @@ class LoginController extends BaseController | ||
| 112 | $mobile = $this->param['mobile']; | 112 | $mobile = $this->param['mobile']; |
| 113 | $user = User::where(['mobile' => $mobile])->first(); | 113 | $user = User::where(['mobile' => $mobile])->first(); |
| 114 | if (empty($user)) { | 114 | if (empty($user)) { |
| 115 | - $this->response('请输入正确的手机号码!', Code::USER_LOGIN_ERROE); | 115 | + $this->response('请输入正确的手机号码!', Code::SYSTEM_ERROR); |
| 116 | } | 116 | } |
| 117 | $last_sms = SmsLog::getLastLog($mobile, SmsLog::TYPE_LOGIN); | 117 | $last_sms = SmsLog::getLastLog($mobile, SmsLog::TYPE_LOGIN); |
| 118 | if ($last_sms && $last_sms->use = SmsLog::USE_USABLE && time() - strtotime($last_sms->created_at) < 60) { | 118 | if ($last_sms && $last_sms->use = SmsLog::USE_USABLE && time() - strtotime($last_sms->created_at) < 60) { |
| 119 | - $this->response('请不要重复发送短信!', Code::USER_LOGIN_ERROE); | 119 | + $this->response('请不要重复发送短信!', Code::SYSTEM_ERROR); |
| 120 | } | 120 | } |
| 121 | $template = config('aliyunsms.login_sms_temp'); | 121 | $template = config('aliyunsms.login_sms_temp'); |
| 122 | $code['code'] = rand(100000,999999); | 122 | $code['code'] = rand(100000,999999); |
| 123 | $ali_sms = new AliSms(); | 123 | $ali_sms = new AliSms(); |
| 124 | $send = $ali_sms->sendSms(strval($mobile), $template, $code); | 124 | $send = $ali_sms->sendSms(strval($mobile), $template, $code); |
| 125 | if (empty($send->Code) && $send->Code != 'OK') { | 125 | if (empty($send->Code) && $send->Code != 'OK') { |
| 126 | - $this->response('发送失败, 请稍后重试!', Code::USER_LOGIN_ERROE); | 126 | + $this->response('发送失败, 请稍后重试!', Code::SYSTEM_ERROR); |
| 127 | } | 127 | } |
| 128 | SmsLog::createLog($mobile, $code['code']); | 128 | SmsLog::createLog($mobile, $code['code']); |
| 129 | $this->response('success'); | 129 | $this->response('success'); |
| @@ -42,7 +42,7 @@ class UserLogic extends BaseLogic | @@ -42,7 +42,7 @@ class UserLogic extends BaseLogic | ||
| 42 | if($info !== false){ | 42 | if($info !== false){ |
| 43 | $this->fail('当前手机号码已注册'); | 43 | $this->fail('当前手机号码已注册'); |
| 44 | } | 44 | } |
| 45 | - if(!isset($this->param['role']) || empty($this->param['role'])){ | 45 | + if(!isset($this->param['role_id']) || empty($this->param['role_id'])){ |
| 46 | $this->fail('一个账号只允许一个超级管理员,请先添加角色'); | 46 | $this->fail('一个账号只允许一个超级管理员,请先添加角色'); |
| 47 | } | 47 | } |
| 48 | $this->param['create_id'] = $this->user['id']; | 48 | $this->param['create_id'] = $this->user['id']; |
| @@ -73,7 +73,7 @@ class LoginAuthMiddleware | @@ -73,7 +73,7 @@ class LoginAuthMiddleware | ||
| 73 | $menu_id = $projectMenuModel->read(['action'=>$action],['id']); | 73 | $menu_id = $projectMenuModel->read(['action'=>$action],['id']); |
| 74 | if($menu_id !== false){ | 74 | if($menu_id !== false){ |
| 75 | if(strpos($role_info['role_menu'], $menu_id['id']) === false){ | 75 | if(strpos($role_info['role_menu'], $menu_id['id']) === false){ |
| 76 | - return response(['code'=>Code::USER_PERMISSION_ERROE,'message'=>'当前用户没有权限']); | 76 | + return response(['code'=>Code::USER_LOGIN_ERROE,'message'=>'当前用户没有权限']); |
| 77 | } | 77 | } |
| 78 | } | 78 | } |
| 79 | } | 79 | } |
-
请 注册 或 登录 后发表评论