diff --git a/crmeb/app/api/controller/v1/wechat/AuthController.php b/crmeb/app/api/controller/v1/wechat/AuthController.php index 68e5a84fb..ac5016300 100644 --- a/crmeb/app/api/controller/v1/wechat/AuthController.php +++ b/crmeb/app/api/controller/v1/wechat/AuthController.php @@ -37,7 +37,12 @@ class AuthController /** * 小程序授权登录 * @param Request $request - * @return mixed + * @return \think\Response + * @throws \think\db\exception\DataNotFoundException + * @throws \think\db\exception\ModelNotFoundException + * @author 吴汐 + * @email 442384644@qq.com + * @date 2023/02/24 */ public function mp_auth(Request $request) { diff --git a/crmeb/app/api/controller/v2/wechat/AuthController.php b/crmeb/app/api/controller/v2/wechat/AuthController.php index 8a5913a8f..822abbb63 100644 --- a/crmeb/app/api/controller/v2/wechat/AuthController.php +++ b/crmeb/app/api/controller/v2/wechat/AuthController.php @@ -79,6 +79,23 @@ class AuthController return app('json')->fail(410019); } + /** + * 小程序绑定手机号 + * @param string $code + * @param string $iv + * @param string $encryptedData + * @return \think\Response + * @author 吴汐 + * @email 442384644@qq.com + * @date 2023/02/24 + */ + public function bindingPhone($code = '', $iv = '', $encryptedData = '') + { + if (!$code || !$iv || !$encryptedData) return app('json')->fail(100100); + $this->services->bindingPhone($code, $iv, $encryptedData); + return app('json')->success(410016); + } + /** 以下方法该版本暂未使用 */ /** * 小程序授权登录 diff --git a/crmeb/app/api/route/v2.php b/crmeb/app/api/route/v2.php index 070ad4002..1f07b6b08 100644 --- a/crmeb/app/api/route/v2.php +++ b/crmeb/app/api/route/v2.php @@ -36,6 +36,8 @@ Route::group('v2', function () { Route::get('bind_status', 'v2.PublicController/bindPhoneStatus'); //小程序授权绑定手机号 Route::post('auth_bindind_phone', 'v2.wechat.AuthController/authBindingPhone'); + //小程序授权后绑定手机号 + Route::post('routine/binding_phone', 'v2.wechat.AuthController/BindingPhone'); //小程序手机号登录直接绑定 Route::post('phone_silence_auth', 'v2.wechat.AuthController/silenceAuthBindingPhone'); //微信手机号登录直接绑定 diff --git a/crmeb/app/model/order/StoreOrder.php b/crmeb/app/model/order/StoreOrder.php index 5003a88ff..5834b8399 100644 --- a/crmeb/app/model/order/StoreOrder.php +++ b/crmeb/app/model/order/StoreOrder.php @@ -596,6 +596,7 @@ class StoreOrder extends BaseModel */ public function searchIdsAttr($query, $value) { - if ($value !== '') $query->whereIn('id', $value); + if (is_string($value)) $value = explode(',', $value); + if (count($value)) $query->whereIn('id', $value); } } diff --git a/crmeb/app/model/product/product/StoreProduct.php b/crmeb/app/model/product/product/StoreProduct.php index ef2616a9d..432a59843 100644 --- a/crmeb/app/model/product/product/StoreProduct.php +++ b/crmeb/app/model/product/product/StoreProduct.php @@ -339,13 +339,14 @@ class StoreProduct extends BaseModel } /** - * 不在当前id中查询 + * 在当前id中查询 * @param $query * @param $value */ public function searchIdsAttr($query, $value) { - if ($value != '') $query->whereIn('id', $value); + if (is_string($value)) $value = explode(',', $value); + if (count($value)) $query->whereIn('id', $value); } /** diff --git a/crmeb/app/services/order/DeliveryServiceServices.php b/crmeb/app/services/order/DeliveryServiceServices.php index 99eca9903..1ad12c8aa 100644 --- a/crmeb/app/services/order/DeliveryServiceServices.php +++ b/crmeb/app/services/order/DeliveryServiceServices.php @@ -158,7 +158,7 @@ class DeliveryServiceServices extends BaseServices */ public function saveDeliveryService(array $data) { - if ($data['image'] == '') throw new AdminException(400466); + if ($data['image'] == '') throw new AdminException(400250); $data['uid'] = $data['image']['uid']; /** @var UserServices $userService */ $userService = app()->make(UserServices::class); diff --git a/crmeb/app/services/system/admin/SystemAdminServices.php b/crmeb/app/services/system/admin/SystemAdminServices.php index 8c3b4209e..7a13fac82 100644 --- a/crmeb/app/services/system/admin/SystemAdminServices.php +++ b/crmeb/app/services/system/admin/SystemAdminServices.php @@ -138,6 +138,7 @@ class SystemAdminServices extends BaseServices 'account' => $adminInfo->getData('account'), 'head_pic' => $adminInfo->getData('head_pic'), 'level' => $adminInfo->getData('level'), + 'real_name' => $adminInfo->getData('real_name'), ], 'logo' => sys_config('site_logo'), 'logo_square' => sys_config('site_logo_square'), diff --git a/crmeb/app/services/wechat/RoutineServices.php b/crmeb/app/services/wechat/RoutineServices.php index c52a8cebd..4897cd8d6 100644 --- a/crmeb/app/services/wechat/RoutineServices.php +++ b/crmeb/app/services/wechat/RoutineServices.php @@ -461,6 +461,34 @@ class RoutineServices extends BaseServices throw new ApiException(410019); } + /** + * @param $code + * @param $iv + * @param $encryptedData + * @return bool + * @author 吴汐 + * @email 442384644@qq.com + * @date 2023/02/24 + */ + public function bindingPhone($code, $iv, $encryptedData) + { + [$userInfoCong, $userInfo] = app()->make(OAuth::class, ['mini_program'])->oauth($code, [ + 'iv' => $iv, + 'encryptedData' => $encryptedData + ]); + if (!$userInfo || !isset($userInfo['purePhoneNumber'])) { + throw new ApiException(410079); + } + $uid = app()->make(WechatUserServices::class)->openidTouid($userInfoCong['openid']); + $userServices = app()->make(UserServices::class); + if ($userServices->count(['phone' => $userInfo['purePhoneNumber']])) { + throw new ApiException(410028); + } + $res = app()->make(UserServices::class)->update(['uid' => $uid], ['phone' => $userInfo['purePhoneNumber']]); + if ($res) return true; + throw new ApiException(410017); + } + /** * 更新用户信息 diff --git a/crmeb/app/services/wechat/WechatUserServices.php b/crmeb/app/services/wechat/WechatUserServices.php index 50f76e0b6..59be45e76 100644 --- a/crmeb/app/services/wechat/WechatUserServices.php +++ b/crmeb/app/services/wechat/WechatUserServices.php @@ -198,6 +198,10 @@ class WechatUserServices extends BaseServices * 授权后获取用户信息 * @param $openid * @param $user_type + * @return array|\think\Model|null + * @author 吴汐 + * @email 442384644@qq.com + * @date 2023/02/24 */ public function getAuthUserInfo($openid, $user_type) { @@ -256,10 +260,14 @@ class WechatUserServices extends BaseServices /** * 微信授权成功后 - * @param $event + * @param array $data + * @return array|mixed|\think\Model|null * @throws \think\db\exception\DataNotFoundException + * @throws \think\db\exception\DbException * @throws \think\db\exception\ModelNotFoundException - * @throws \think\exception\DbException + * @author 吴汐 + * @email 442384644@qq.com + * @date 2023/02/24 */ public function wechatOauthAfter(array $data) { diff --git a/template/admin/src/components/main/components/header-notice/index.vue b/template/admin/src/components/main/components/header-notice/index.vue index 747c9f8c4..c49b7f56f 100644 --- a/template/admin/src/components/main/components/header-notice/index.vue +++ b/template/admin/src/components/main/components/header-notice/index.vue @@ -6,7 +6,7 @@ - + {{ item.title diff --git a/template/admin/src/components/main/components/header-search/index.vue b/template/admin/src/components/main/components/header-search/index.vue index 78376bda1..9d8e481d9 100644 --- a/template/admin/src/components/main/components/header-search/index.vue +++ b/template/admin/src/components/main/components/header-search/index.vue @@ -6,6 +6,7 @@ placeholder="菜单搜索" filterable remote + clearable :remote-method="remoteMethod" :loading="loading" > @@ -19,22 +20,22 @@ - diff --git a/template/admin/src/pages/marketing/storeCombination/index.vue b/template/admin/src/pages/marketing/storeCombination/index.vue index 170c88089..ec5e3e3de 100644 --- a/template/admin/src/pages/marketing/storeCombination/index.vue +++ b/template/admin/src/pages/marketing/storeCombination/index.vue @@ -1,10 +1,5 @@