feat: 新增用户注册地址信息创建功能

This commit is contained in:
mkm 2024-06-14 16:05:48 +08:00
parent 39b3e124cd
commit 218bbdfe4b
2 changed files with 20 additions and 3 deletions

View File

@ -16,6 +16,7 @@ namespace app\admin\logic\user;
use app\common\enum\user\UserTerminalEnum;
use app\common\logic\BaseLogic;
use app\common\model\user\User;
use app\common\model\user\UserAddress;
use think\facade\Db;
use app\common\service\FileService;
use Webman\Config;
@ -73,7 +74,7 @@ class UserLogic extends BaseLogic
Db::startTrans();
try {
$res=User::create([
$data=[
'avatar' => $avatar,
'real_name' =>'',
'nickname' => '用户'.time(),
@ -81,6 +82,19 @@ class UserLogic extends BaseLogic
'password' => $password,
'mobile' => $params['mobile'],
'user_money' => $params['user_money']
];
$res=User::create($data);
UserAddress::create([
'uid' => $res['id'],
'real_name' => $data['nickname'],
'mobile' => $params['mobile'],
'province' => $params['province'],
'city' => $params['city'],
'district' => $params['district'],
'street' => $params['street'],
'village' => $params['village'],
'brigade' => $params['brigade'],
'is_default' => 1,
]);
Db::commit();

View File

@ -38,12 +38,15 @@ class UserShipLists extends BaseAdminDataLists
{
$field = "id,title";
$arr[]=['id'=>0,'title'=>'普通会员'];
$lists = UserShip::where($this->searchWhere)
->limit($this->limitOffset, $this->limitLength)
->field($field)
->order('sort desc')
->select()->toArray();
return $lists;
->select()
->toArray();
return array_merge($arr,$lists);
}