用户发布权限
This commit is contained in:
@@ -115,8 +115,8 @@ class UserController extends BaseController
|
|||||||
|
|
||||||
$ossservice = new OssService();
|
$ossservice = new OssService();
|
||||||
if(isset($data['avatar']) && !empty($data['avatar']) && strpos($data['avatar'], 'http') === false){
|
if(isset($data['avatar']) && !empty($data['avatar']) && strpos($data['avatar'], 'http') === false){
|
||||||
//$data['avatar_pull'] = $ossservice->generatePrivateUrl($data['avatar']);
|
$data['avatar_pull'] = $ossservice->generatePrivateUrl($data['avatar']);
|
||||||
$data['avatar_pull'] = '/proxy/ossurl?file='.$data['avatar'];
|
// $data['avatar_pull'] = '/proxy/ossurl?file='.$data['avatar'];
|
||||||
}else{
|
}else{
|
||||||
$data['avatar_pull'] = $data['avatar'];
|
$data['avatar_pull'] = $data['avatar'];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,49 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace app\common\model;
|
||||||
|
|
||||||
|
use support\Model;
|
||||||
|
|
||||||
|
class UserOld extends Model
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The connection name for the model.
|
||||||
|
*
|
||||||
|
* @var string|null
|
||||||
|
*/
|
||||||
|
protected $connection = 'mysql';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The table associated with the model.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $table = 'user_old';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The primary key associated with the table.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $primaryKey = 'id';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Indicates if the model should be timestamped.
|
||||||
|
*
|
||||||
|
* @var bool
|
||||||
|
*/
|
||||||
|
public $timestamps = true;
|
||||||
|
|
||||||
|
|
||||||
|
protected $dateFormat = 'U';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 允许自动填充模型字段
|
||||||
|
*/
|
||||||
|
protected $fillable = ['id', 'name', 'mobile'];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 不允许自动填充模型字段
|
||||||
|
*/
|
||||||
|
protected $guarded = [];
|
||||||
|
}
|
||||||
@@ -5,6 +5,7 @@ namespace app\common\service;
|
|||||||
use app\common\model\PostMedia;
|
use app\common\model\PostMedia;
|
||||||
use app\common\model\Sku;
|
use app\common\model\Sku;
|
||||||
use app\common\model\User;
|
use app\common\model\User;
|
||||||
|
use app\common\model\UserOld;
|
||||||
use app\common\validate\PostValidate;
|
use app\common\validate\PostValidate;
|
||||||
use app\common\traits\crud\CrudServiceTrait;
|
use app\common\traits\crud\CrudServiceTrait;
|
||||||
use app\common\model\Post;
|
use app\common\model\Post;
|
||||||
@@ -120,6 +121,15 @@ class PostService
|
|||||||
if(empty($user->latitude) || empty($user->longitude) || empty($user->mobile)){
|
if(empty($user->latitude) || empty($user->longitude) || empty($user->mobile)){
|
||||||
throw new BusinessException('请补全个人中心的门店位置及电话');
|
throw new BusinessException('请补全个人中心的门店位置及电话');
|
||||||
}
|
}
|
||||||
|
if(empty($user->is_release)){
|
||||||
|
$UserOld = UserOld::where('mobile', $user->mobile)->first();
|
||||||
|
if(!empty($UserOld)){
|
||||||
|
$user->is_release = 1;
|
||||||
|
$user->save();
|
||||||
|
}else{
|
||||||
|
throw new BusinessException('请联系管理员申请发布权限');
|
||||||
|
}
|
||||||
|
}
|
||||||
$data['status'] = 1;
|
$data['status'] = 1;
|
||||||
$data['latitude'] = $user->latitude;
|
$data['latitude'] = $user->latitude;
|
||||||
$data['longitude'] = $user->longitude;
|
$data['longitude'] = $user->longitude;
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
namespace app\common\service;
|
namespace app\common\service;
|
||||||
|
|
||||||
use app\common\logic\AuthLogic;
|
use app\common\logic\AuthLogic;
|
||||||
|
use app\common\model\UserOld;
|
||||||
use app\common\validate\UserValidate;
|
use app\common\validate\UserValidate;
|
||||||
use app\common\traits\crud\CrudServiceTrait;
|
use app\common\traits\crud\CrudServiceTrait;
|
||||||
use app\common\model\User;
|
use app\common\model\User;
|
||||||
@@ -256,7 +257,8 @@ class UserService
|
|||||||
$wxinfo = $wechatService->xcxOpenid($data['code']);
|
$wxinfo = $wechatService->xcxOpenid($data['code']);
|
||||||
Log::info('wxinfo',[$wxinfo]);
|
Log::info('wxinfo',[$wxinfo]);
|
||||||
|
|
||||||
$name = '微信用户_' . self::generate(8);
|
$sn = self::generate(8);
|
||||||
|
$name = '微信用户_' . $sn;
|
||||||
// 用户信息
|
// 用户信息
|
||||||
$user = User::firstOrCreate(
|
$user = User::firstOrCreate(
|
||||||
['openid' => $wxinfo['openid']],
|
['openid' => $wxinfo['openid']],
|
||||||
@@ -264,6 +266,7 @@ class UserService
|
|||||||
'nickname' => $name,
|
'nickname' => $name,
|
||||||
//'unionid' => $wxinfo['unionid'],
|
//'unionid' => $wxinfo['unionid'],
|
||||||
'name' => $name,
|
'name' => $name,
|
||||||
|
'sn' => $sn,
|
||||||
'avatar' => 'bsh_datax/user/20251021/a4ee815405a1506abeec1af0f738f70f_68f6e76514b66.jpg'
|
'avatar' => 'bsh_datax/user/20251021/a4ee815405a1506abeec1af0f738f70f_68f6e76514b66.jpg'
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
@@ -287,8 +290,14 @@ class UserService
|
|||||||
$wechatService = new WechatService();
|
$wechatService = new WechatService();
|
||||||
$wxinfo = $wechatService->xcxPhoneNumber($data['phone_code']);
|
$wxinfo = $wechatService->xcxPhoneNumber($data['phone_code']);
|
||||||
|
|
||||||
|
$mobile = $wxinfo['phone_info']['phoneNumber'];
|
||||||
|
$old = UserOld::where('mobile', $mobile)->first();
|
||||||
$uinfo = User::where('id', $request->user->uid)->first();
|
$uinfo = User::where('id', $request->user->uid)->first();
|
||||||
$uinfo->mobile = $wxinfo['phone_info']['phoneNumber'];
|
if ($old) {
|
||||||
|
$uinfo->name = $old->name;
|
||||||
|
$uinfo->is_release = 1;
|
||||||
|
}
|
||||||
|
$uinfo->mobile = $mobile;
|
||||||
$uinfo->save();
|
$uinfo->save();
|
||||||
|
|
||||||
return $wxinfo;
|
return $wxinfo;
|
||||||
|
|||||||
Reference in New Issue
Block a user