|
|
@@ -27,7 +27,9 @@ use app\common\service\{
|
|
|
wechat\WeChatRequestService
|
|
|
};
|
|
|
use app\common\model\agricultural_machinery\UserService;
|
|
|
+use app\common\model\agricultural_machinery\ServiceCategory;
|
|
|
use app\common\model\ServiceCharge;
|
|
|
+use app\common\model\asset\AssetArea;
|
|
|
use app\common\model\recharge\RechargeOrder;
|
|
|
use app\common\model\user\{User, UserAuth};
|
|
|
use think\facade\{Db, Config};
|
|
|
@@ -51,10 +53,6 @@ class ServiceLogic extends BaseLogic
|
|
|
{
|
|
|
Db::startTrans();
|
|
|
try {
|
|
|
-// $userSn = User::createUserSn();
|
|
|
-// $passwordSalt = Config::get('project.unique_identification');
|
|
|
-// $password = create_password($params['password'], $passwordSalt);
|
|
|
-// $avatar = ConfigService::get('default_image', 'user_avatar');
|
|
|
|
|
|
$result = UserService::create([
|
|
|
'user_id' => $params['user_id'],
|
|
|
@@ -63,8 +61,8 @@ class ServiceLogic extends BaseLogic
|
|
|
'mobile' => $params['mobile'],
|
|
|
'agricultural_machinery_model' =>$params['agricultural_machinery_model'],
|
|
|
'images' => $params['images'],
|
|
|
- 'cate_id' => $params['cate_id'],
|
|
|
- 'area_id' => $params['area_id'],
|
|
|
+ 'cate_id' => ','.$params['cate_id'].',',
|
|
|
+ 'area_id' => ','.$params['area_id'].',',
|
|
|
'money' => $params['money'],
|
|
|
'content'=>$params['content']
|
|
|
]);
|
|
|
@@ -75,10 +73,10 @@ class ServiceLogic extends BaseLogic
|
|
|
case 1 :
|
|
|
$order_money =$service_fee['agricultural_machinery_service_fee'];
|
|
|
break;
|
|
|
- case 1 :
|
|
|
+ case 2 :
|
|
|
$order_money =$service_fee['bake_service_fee'];
|
|
|
break;
|
|
|
- case 1 :
|
|
|
+ case 3 :
|
|
|
$order_money =$service_fee['air_control_service_fee'];
|
|
|
break;
|
|
|
}
|
|
|
@@ -109,45 +107,38 @@ class ServiceLogic extends BaseLogic
|
|
|
|
|
|
|
|
|
/**
|
|
|
- * @notes 账号/手机号登录,手机号验证码
|
|
|
+ * @notes
|
|
|
* @param $params
|
|
|
* @return array|false
|
|
|
* @author 段誉
|
|
|
* @date 2022/9/6 19:26
|
|
|
*/
|
|
|
- public static function login($params)
|
|
|
+ public static function getInfo($params,$user_id)
|
|
|
{
|
|
|
try {
|
|
|
- // 账号/手机号 密码登录
|
|
|
- $where = ['account|mobile' => $params['account']];
|
|
|
- if ($params['scene'] == LoginEnum::MOBILE_CAPTCHA) {
|
|
|
- //手机验证码登录
|
|
|
- $where = ['mobile' => $params['account']];
|
|
|
- }
|
|
|
|
|
|
- $user = User::where($where)->findOrEmpty();
|
|
|
- if ($user->isEmpty()) {
|
|
|
- throw new \Exception('用户不存在');
|
|
|
+ $where = [];
|
|
|
+ $where[]=['user_id','=',$user_id];
|
|
|
+ $where[]=['type','=',$params['type']];
|
|
|
+
|
|
|
+ $serviceInfo = UserService::where($where)->findOrEmpty();
|
|
|
+
|
|
|
+ if($serviceInfo->isEmpty()){
|
|
|
+ $status = -1;
|
|
|
+ }else{
|
|
|
+ if($serviceInfo['status'] == 0){
|
|
|
+ $status = 0;
|
|
|
+ }else if($serviceInfo['status'] == 2){
|
|
|
+ $status = 2;
|
|
|
+ }else{
|
|
|
+ $status = 1;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
- //更新登录信息
|
|
|
- $user->login_time = time();
|
|
|
- $user->login_ip = request()->ip();
|
|
|
- $user->save();
|
|
|
-
|
|
|
- //设置token
|
|
|
- $userInfo = UserTokenService::setToken($user->id, $params['terminal']);
|
|
|
-
|
|
|
- //返回登录信息
|
|
|
- $avatar = $user->avatar ?: Config::get('project.default_image.user_avatar');
|
|
|
- $avatar = FileService::getFileUrl($avatar);
|
|
|
|
|
|
return [
|
|
|
- 'nickname' => $userInfo['nickname'],
|
|
|
- 'sn' => $userInfo['sn'],
|
|
|
- 'mobile' => $userInfo['mobile'],
|
|
|
- 'avatar' => $avatar,
|
|
|
- 'token' => $userInfo['token'],
|
|
|
+ 'status' => $status,
|
|
|
+ 'info' => $serviceInfo,
|
|
|
];
|
|
|
} catch (\Exception $e) {
|
|
|
self::setError($e->getMessage());
|
|
|
@@ -157,27 +148,39 @@ class ServiceLogic extends BaseLogic
|
|
|
|
|
|
|
|
|
/**
|
|
|
- * @notes 退出登录
|
|
|
- * @param $userInfo
|
|
|
- * @return bool
|
|
|
- * @throws \think\db\exception\DataNotFoundException
|
|
|
- * @throws \think\db\exception\DbException
|
|
|
- * @throws \think\db\exception\ModelNotFoundException
|
|
|
+ * @notes 地址列表
|
|
|
* @author 段誉
|
|
|
* @date 2022/9/16 17:56
|
|
|
*/
|
|
|
- public static function logout($userInfo)
|
|
|
+ public static function getsAreaLists($get)
|
|
|
{
|
|
|
- //token不存在,不注销
|
|
|
- if (!isset($userInfo['token'])) {
|
|
|
- return false;
|
|
|
+ $where=[];
|
|
|
+ $where[]=['status','=',1];
|
|
|
+ if(isset($get['title'])){
|
|
|
+ $where[]=['title','like','%'.$get['title'].'%'];
|
|
|
+ }
|
|
|
+ $area_list = AssetArea::where($where)->field('id,title')->order('sort desc,id asc')->select()->toArray();
|
|
|
+
|
|
|
+ return $area_list;
|
|
|
+ }
|
|
|
+ /**
|
|
|
+ * @notes 地址列表
|
|
|
+ * @author 段誉
|
|
|
+ * @date 2022/9/16 17:56
|
|
|
+ */
|
|
|
+ public static function getsCateLists($get)
|
|
|
+ {
|
|
|
+ $where=[];
|
|
|
+ $where[]=['type','=',$get['type']];
|
|
|
+ $where[]=['status','=',1];
|
|
|
+ if(isset($get['name'])){
|
|
|
+ $where[]=['name','like','%'.$get['name'].'%'];
|
|
|
}
|
|
|
+ $cate_list = ServiceCategory::where($where)->field('id,name')->order('sort desc,id asc')->select()->toArray();
|
|
|
|
|
|
- //设置token过期
|
|
|
- return UserTokenService::expireToken($userInfo['token']);
|
|
|
+ return $cate_list;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
/**
|
|
|
* @notes 获取微信请求code的链接
|
|
|
* @param string $url
|