|
@@ -0,0 +1,27 @@
|
|
|
+<?php
|
|
|
+
|
|
|
+namespace app\data\model;
|
|
|
+
|
|
|
+use think\admin\Model;
|
|
|
+
|
|
|
+/**
|
|
|
+ * 商城商品主模型
|
|
|
+ * Class ShopGoods
|
|
|
+ * @package app\data\model
|
|
|
+ */
|
|
|
+class SystemUser extends Model
|
|
|
+{
|
|
|
+ public static function createMerchant(DataMerchants $merchants){
|
|
|
+ $has=self::where('username',$merchants->contact_phone)->find();
|
|
|
+ throw_if($has,'该商家已存在无法创建');
|
|
|
+ $user=new self;
|
|
|
+ $user->username=$merchants->contact_phone;
|
|
|
+ $user->contact_phone=$merchants->contact_phone;
|
|
|
+ $user->nickname=$merchants['name'];
|
|
|
+ $user->headimg=$merchants['head_img'];
|
|
|
+ $user->authorize=",156,";
|
|
|
+ $user->save();
|
|
|
+ $merchants['admin_id']=$user->id;
|
|
|
+ $merchants->save();
|
|
|
+ }
|
|
|
+}
|