|
|
|
@ -117,31 +117,28 @@ class LanzuCsInfoController extends AdminController |
|
|
|
$form->saved(function (Form $form, $cid) { |
|
|
|
$model = new modelCsInfo(); |
|
|
|
if ($form->isCreating()) { |
|
|
|
DB::transaction(function () use ($form, $model, $cid){ |
|
|
|
//>>1.添加登录帐号
|
|
|
|
$res = Auth::addAdminUser($form, $model, $cid, 'lanzu_cs'); |
|
|
|
if ($res == -1) { |
|
|
|
return $form->error('该手机号作为登陆帐号已存在!'); |
|
|
|
} elseif ($res == -2) { |
|
|
|
return $form->error('添加失败!'); |
|
|
|
} |
|
|
|
|
|
|
|
//>>2.生成小程序二维码
|
|
|
|
$cs = $model->find($cid); |
|
|
|
$aid = $cs->admin_user_id; |
|
|
|
$images = new Images(); |
|
|
|
$param = "p=index&sid={$aid}"; |
|
|
|
$path = 'zh_cjdianc/pages/Liar/loginindex'; |
|
|
|
$qrcode = $images->createQrCode($param, $path); |
|
|
|
$fileName = 'public/upload/' . 'qrcode' . '/' . date('Y') . '/' . date('m-d') . '/' . rand(100000000000000, 999999999999999) . '.png'; |
|
|
|
$result = $images->uploadOss($qrcode, $fileName); |
|
|
|
if ($result == true) { |
|
|
|
//>>3.保存二维码路径
|
|
|
|
$cs->qrcode_path = $fileName; |
|
|
|
$cs->save(); |
|
|
|
} |
|
|
|
}); |
|
|
|
//>>1.添加登录帐号
|
|
|
|
$res = Auth::addAdminUser($form, $model, $cid, 'lanzu_cs'); |
|
|
|
if ($res == -1) { |
|
|
|
return $form->error('该手机号作为登陆帐号已存在!'); |
|
|
|
} elseif ($res == -2) { |
|
|
|
return $form->error('添加失败!'); |
|
|
|
} |
|
|
|
|
|
|
|
//>>2.生成小程序二维码
|
|
|
|
$cs = $model->find($cid); |
|
|
|
$aid = $cs->admin_user_id; |
|
|
|
$images = new Images(); |
|
|
|
$param = "p=index&sid={$aid}"; |
|
|
|
$path = 'zh_cjdianc/pages/Liar/loginindex'; |
|
|
|
$qrcode = $images->createQrCode($param, $path); |
|
|
|
$fileName = 'public/upload/' . 'qrcode' . '/' . date('Y') . '/' . date('m-d') . '/' . rand(100000000000000, 999999999999999) . '.png'; |
|
|
|
$result = $images->uploadOss($qrcode, $fileName); |
|
|
|
if ($result == true) { |
|
|
|
//>>3.保存二维码路径
|
|
|
|
$cs->qrcode_path = $fileName; |
|
|
|
$cs->save(); |
|
|
|
} |
|
|
|
} else { |
|
|
|
//>>4.编辑时同步登陆帐号状态
|
|
|
|
$adu = new AdminUsers(); |
|
|
|
|