feat: 新增创建用户记录功能
This commit is contained in:
parent
d930bebe6c
commit
f51c9174b6
@ -23,6 +23,7 @@ use app\common\model\store_order\StoreOrder;
|
||||
use app\common\model\user\User;
|
||||
use app\common\model\user\UserAddress;
|
||||
use app\common\model\user\UserRecharge;
|
||||
use app\common\model\user_create_log\UserCreateLog;
|
||||
use app\common\model\user_label\UserLabel;
|
||||
use app\common\model\user_sign\UserSign;
|
||||
use app\common\model\vip_flow\VipFlow;
|
||||
@ -94,6 +95,12 @@ class UserLogic extends BaseLogic
|
||||
|
||||
];
|
||||
$res=User::create($data);
|
||||
UserCreateLog::create([
|
||||
'uid' => $res['id'],
|
||||
'create_uid' => $params['create_uid']??0,
|
||||
'store_id' => $params['store_id']??0,
|
||||
'staff_id' => $params['staff_id']??0,
|
||||
]);
|
||||
UserAddress::create([
|
||||
'uid' => $res['id'],
|
||||
'real_name' => $params['real_name']??"",
|
||||
|
@ -5,6 +5,7 @@ namespace app\api\controller\store;
|
||||
use app\admin\logic\user\UserLogic as UserUserLogic;
|
||||
use app\api\lists\store\SystemStoreLists;
|
||||
use app\api\controller\BaseApiController;
|
||||
use app\api\lists\user_create_log\UserCreateLogLists;
|
||||
use app\api\logic\store\StoreLogic;
|
||||
use app\api\logic\user\UserLogic;
|
||||
use app\api\validate\UserValidate;
|
||||
@ -23,6 +24,13 @@ class StoreController extends BaseApiController
|
||||
return $this->dataLists(new SystemStoreLists());
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建用户记录列表
|
||||
*/
|
||||
public function create_lists()
|
||||
{
|
||||
return $this->dataLists(new UserCreateLogLists());
|
||||
}
|
||||
|
||||
/**
|
||||
* 门店信息
|
||||
@ -57,6 +65,7 @@ class StoreController extends BaseApiController
|
||||
$recharge_type = $this->request->post('recharge_type',''); //微信支付条码
|
||||
$find=User::where('mobile',$params['mobile'])->find();
|
||||
if(!$find){
|
||||
$params['create_uid']=$this->userId;
|
||||
$find=UserUserLogic::StoreAdd($params);
|
||||
}else{
|
||||
$find['real_name']=$params['real_name'];
|
||||
|
70
app/api/lists/user_create_log/UserCreateLogLists.php
Normal file
70
app/api/lists/user_create_log/UserCreateLogLists.php
Normal file
@ -0,0 +1,70 @@
|
||||
<?php
|
||||
|
||||
namespace app\api\lists\user_create_log;
|
||||
|
||||
|
||||
use app\admin\lists\BaseAdminDataLists;
|
||||
use app\common\model\system_store\SystemStore;
|
||||
use app\common\lists\ListsSearchInterface;
|
||||
use app\common\model\user\User;
|
||||
use app\common\model\user_create_log\UserCreateLog;
|
||||
|
||||
/**
|
||||
* 用户前端添加记录列表
|
||||
* Class UserCreateLogLists
|
||||
* @package app\admin\listssystem_store
|
||||
*/
|
||||
class UserCreateLogLists extends BaseAdminDataLists implements ListsSearchInterface
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @notes 设置搜索条件
|
||||
* @return \string[][]
|
||||
* @author admin
|
||||
* @date 2024/05/31 17:45
|
||||
*/
|
||||
public function setSearch(): array
|
||||
{
|
||||
return [
|
||||
'=' => ['store_id'],
|
||||
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取用户前端添加记录列表
|
||||
* @return array
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author admin
|
||||
* @date 2024/05/31 17:45
|
||||
*/
|
||||
public function lists(): array
|
||||
{
|
||||
$data = UserCreateLog::where($this->searchWhere)
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->order(['id' => 'desc'])
|
||||
->select()->each(function ($item){
|
||||
$item['system_store_name'] = SystemStore::where('id',$item['store_id'])->value('name');
|
||||
$item['nickname'] = User::where('id',$item['uid'])->value('real_name');
|
||||
$item['create_nickname'] = User::where('id',$item['create_uid'])->value('real_name');
|
||||
})
|
||||
->toArray();
|
||||
return $data;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取用户前端添加记录数量
|
||||
* @return int
|
||||
* @author admin
|
||||
* @date 2024/05/31 17:45
|
||||
*/
|
||||
public function count(): int
|
||||
{
|
||||
return UserCreateLog::where($this->searchWhere)->count();
|
||||
}
|
||||
}
|
22
app/common/model/user_create_log/UserCreateLog.php
Normal file
22
app/common/model/user_create_log/UserCreateLog.php
Normal file
@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace app\common\model\user_create_log;
|
||||
|
||||
|
||||
use app\common\model\BaseModel;
|
||||
use think\model\concern\SoftDelete;
|
||||
|
||||
|
||||
/**
|
||||
* 用户前端添加记录
|
||||
* Class UserCreateLog
|
||||
* @package app\common\model\user_create_log
|
||||
*/
|
||||
class UserCreateLog extends BaseModel
|
||||
{
|
||||
use SoftDelete;
|
||||
protected $name = 'user_create_log';
|
||||
protected $deleteTime = 'delete_time';
|
||||
|
||||
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user