更新
This commit is contained in:
parent
176695bfa4
commit
a44364f031
@ -105,7 +105,7 @@ class UserLogic extends BaseLogic
|
|||||||
public static function detail(int $userId): array
|
public static function detail(int $userId): array
|
||||||
{
|
{
|
||||||
$field = [
|
$field = [
|
||||||
'id', 'sn', 'account', 'nickname', 'avatar', 'real_name',
|
'id', 'account', 'nickname', 'avatar', 'real_name',
|
||||||
'sex', 'mobile', 'create_time', 'login_time', 'channel'
|
'sex', 'mobile', 'create_time', 'login_time', 'channel'
|
||||||
];
|
];
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@ use app\api\validate\{LoginAccountValidate, RegisterValidate, WebScanLoginValida
|
|||||||
|
|
||||||
class LoginController extends BaseApiController
|
class LoginController extends BaseApiController
|
||||||
{
|
{
|
||||||
public $notNeedLogin = ['account','logout'];
|
public $notNeedLogin = ['account','logout','mnpLogin'];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @notes 账号登录
|
* @notes 账号登录
|
||||||
|
@ -23,6 +23,18 @@ class RetailOrderController extends BaseApiController
|
|||||||
|
|
||||||
return $this->dataLists(new RetailOrderList());
|
return $this->dataLists(new RetailOrderList());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function order_count(){
|
||||||
|
$userId=$this->request->userId;
|
||||||
|
$where=['uid'=>$userId,'paid'=>0];
|
||||||
|
$no_pay=Cashierclass::where($where)->count();
|
||||||
|
$where['paid']=1;
|
||||||
|
$where['status']=0;
|
||||||
|
$waiting=Cashierclass::where($where)->count();
|
||||||
|
$where['status']=1;
|
||||||
|
$receiving=Cashierclass::where($where)->count();
|
||||||
|
return $this->success('ok',['no_pay'=>$no_pay,'waiting'=>$waiting,'receiving'=>$receiving]);
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* @notes 检测零售订单
|
* @notes 检测零售订单
|
||||||
*/
|
*/
|
||||||
|
@ -26,7 +26,7 @@ class RetailOrderList extends BaseAdminDataLists implements ListsSearchInterface
|
|||||||
public function setSearch(): array
|
public function setSearch(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'=' => ['number', 'paid',],
|
'=' => ['number', 'paid','status'],
|
||||||
'between_time' => 'create_time',
|
'between_time' => 'create_time',
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
@ -50,6 +50,7 @@ class RetailOrderList extends BaseAdminDataLists implements ListsSearchInterface
|
|||||||
->select()
|
->select()
|
||||||
->each(function($item){
|
->each(function($item){
|
||||||
$item['goods_list']=Cashierinfo::where('pid',$item['id'])->with('goodsName')->field('goods,nums,price sell')->limit(3)->select();
|
$item['goods_list']=Cashierinfo::where('pid',$item['id'])->with('goodsName')->field('goods,nums,price sell')->limit(3)->select();
|
||||||
|
$item['goods_count']=count(explode(',',$item['cart_id']));
|
||||||
})
|
})
|
||||||
->toArray();
|
->toArray();
|
||||||
}
|
}
|
||||||
|
@ -51,7 +51,6 @@ class LoginLogic extends BaseLogic
|
|||||||
$avatar = ConfigService::get('default_image', 'user_avatar');
|
$avatar = ConfigService::get('default_image', 'user_avatar');
|
||||||
|
|
||||||
User::create([
|
User::create([
|
||||||
'sn' => $userSn,
|
|
||||||
'avatar' => $avatar,
|
'avatar' => $avatar,
|
||||||
'nickname' => '用户' . $userSn,
|
'nickname' => '用户' . $userSn,
|
||||||
'account' => $params['account'],
|
'account' => $params['account'],
|
||||||
|
@ -24,8 +24,8 @@ class AddressLogic extends BaseLogic
|
|||||||
*/
|
*/
|
||||||
public static function add(array $params): bool
|
public static function add(array $params): bool
|
||||||
{
|
{
|
||||||
Db::startTrans();
|
// Db::startTrans();
|
||||||
try {
|
// try {
|
||||||
if($params['is_default']==1){
|
if($params['is_default']==1){
|
||||||
UserAddress::where('uid',$params['uid'])->update(['is_default'=>0]);
|
UserAddress::where('uid',$params['uid'])->update(['is_default'=>0]);
|
||||||
}
|
}
|
||||||
@ -38,11 +38,11 @@ class AddressLogic extends BaseLogic
|
|||||||
]);
|
]);
|
||||||
Db::commit();
|
Db::commit();
|
||||||
return true;
|
return true;
|
||||||
} catch (\Exception $e) {
|
// } catch (\Exception $e) {
|
||||||
Db::rollback();
|
// Db::rollback();
|
||||||
self::setError($e->getMessage());
|
// self::setError($e->getMessage());
|
||||||
return false;
|
// return false;
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -6,6 +6,8 @@ namespace app\api\service;
|
|||||||
use app\common\enum\YesNoEnum;
|
use app\common\enum\YesNoEnum;
|
||||||
use app\common\model\user\{User, UserAuth};
|
use app\common\model\user\{User, UserAuth};
|
||||||
use app\common\enum\user\UserTerminalEnum;
|
use app\common\enum\user\UserTerminalEnum;
|
||||||
|
use app\common\model\merchat\Merchant;
|
||||||
|
use app\common\model\supplier\Supplier;
|
||||||
use app\common\service\{ConfigService, storage\Driver as StorageDriver};
|
use app\common\service\{ConfigService, storage\Driver as StorageDriver};
|
||||||
use think\Exception;
|
use think\Exception;
|
||||||
|
|
||||||
@ -63,7 +65,7 @@ class WechatUserService
|
|||||||
$unionid = $this->unionid;
|
$unionid = $this->unionid;
|
||||||
|
|
||||||
$user = User::alias('u')
|
$user = User::alias('u')
|
||||||
->field('u.id,u.sn,u.mobile,u.nickname,u.avatar,u.mobile,u.is_disable,u.is_new_user')
|
->field('u.id,u.mobile,u.nickname,u.avatar,u.is_disable,u.is_new_user')
|
||||||
->join('user_auth au', 'au.user_id = u.id')
|
->join('user_auth au', 'au.user_id = u.id')
|
||||||
->where(function ($query) use ($openid, $unionid) {
|
->where(function ($query) use ($openid, $unionid) {
|
||||||
$query->whereOr(['au.openid' => $openid]);
|
$query->whereOr(['au.openid' => $openid]);
|
||||||
@ -74,6 +76,8 @@ class WechatUserService
|
|||||||
->findOrEmpty();
|
->findOrEmpty();
|
||||||
|
|
||||||
$this->user = $user;
|
$this->user = $user;
|
||||||
|
// $this->user->merchat=Merchant::where('uid',$user['id'])->find();
|
||||||
|
$this->user->supplier=Supplier::where('uid',$user['id'])->field('id,mer_name')->find();
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -131,7 +135,6 @@ class WechatUserService
|
|||||||
}
|
}
|
||||||
|
|
||||||
$userSn = User::createUserSn();
|
$userSn = User::createUserSn();
|
||||||
$this->user->sn = $userSn;
|
|
||||||
$this->user->account = 'u' . $userSn;
|
$this->user->account = 'u' . $userSn;
|
||||||
$this->user->nickname = "用户" . $userSn;
|
$this->user->nickname = "用户" . $userSn;
|
||||||
$this->user->avatar = $avatar;
|
$this->user->avatar = $avatar;
|
||||||
|
@ -42,8 +42,6 @@ class UserAddressValidate extends BaseValidate
|
|||||||
|
|
||||||
];
|
];
|
||||||
|
|
||||||
];
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @notes 添加场景
|
* @notes 添加场景
|
||||||
|
1
app/common/cache/UserTokenCache.php
vendored
1
app/common/cache/UserTokenCache.php
vendored
@ -82,7 +82,6 @@ class UserTokenCache extends BaseCache
|
|||||||
'merchant' => $merchant,
|
'merchant' => $merchant,
|
||||||
'supplier' => $supplier,
|
'supplier' => $supplier,
|
||||||
'token' => $token,
|
'token' => $token,
|
||||||
'sn' => $user->sn,
|
|
||||||
'mobile' => $user->mobile,
|
'mobile' => $user->mobile,
|
||||||
'avatar' => $user->avatar,
|
'avatar' => $user->avatar,
|
||||||
'terminal' => $userSession->terminal,
|
'terminal' => $userSession->terminal,
|
||||||
|
@ -44,7 +44,7 @@ class User extends BaseModel
|
|||||||
public function searchKeywordAttr($query, $value, $data)
|
public function searchKeywordAttr($query, $value, $data)
|
||||||
{
|
{
|
||||||
if ($value) {
|
if ($value) {
|
||||||
$query->where('sn|nickname|mobile', 'like', '%' . $value . '%');
|
$query->where('nickname|mobile', 'like', '%' . $value . '%');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -149,14 +149,14 @@ class User extends BaseModel
|
|||||||
*/
|
*/
|
||||||
public static function createUserSn($prefix = '', $length = 8)
|
public static function createUserSn($prefix = '', $length = 8)
|
||||||
{
|
{
|
||||||
$rand_str = '';
|
// $rand_str = '';
|
||||||
for ($i = 0; $i < $length; $i++) {
|
// for ($i = 0; $i < $length; $i++) {
|
||||||
$rand_str .= mt_rand(0, 9);
|
// $rand_str .= mt_rand(0, 9);
|
||||||
}
|
// }
|
||||||
$sn = $prefix . $rand_str;
|
$sn = $prefix . time();
|
||||||
if (User::where(['sn' => $sn])->find()) {
|
// if (User::where(['sn' => $sn])->find()) {
|
||||||
return self::createUserSn($prefix, $length);
|
// return self::createUserSn($prefix, $length);
|
||||||
}
|
// }
|
||||||
return $sn;
|
return $sn;
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user