|
@@ -7,6 +7,7 @@ use app\admin\model\User as ModelUser;
|
|
|
use app\admin\model\UserAddress;
|
|
|
use app\admin\model\UserSubscribeMessage;
|
|
|
use app\common\controller\Api;
|
|
|
+use app\common\library\Auth;
|
|
|
use app\common\library\Ems;
|
|
|
use app\common\library\Sms;
|
|
|
use fast\Http;
|
|
@@ -664,6 +665,59 @@ class User extends Api
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 子账户删除
|
|
|
+ *
|
|
|
+ * @ApiMethod (POST)
|
|
|
+ * @param string $id 删除id
|
|
|
+ */
|
|
|
+ public function son_del()
|
|
|
+ {
|
|
|
+ $del_id = $this->request->post('id');
|
|
|
+
|
|
|
+ $del_user = ModelUser::where('id', $del_id)->where('pid', $this->auth->id)->find();
|
|
|
+ if(!$del_user){
|
|
|
+ $this->error("账户不存在");
|
|
|
+ }
|
|
|
+
|
|
|
+ if(Auth::instance()->delete($del_id)){
|
|
|
+ $this->success("删除成功");
|
|
|
+ }else{
|
|
|
+ $this->error("请稍后重试");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 子账户修改
|
|
|
+ *
|
|
|
+ * @ApiMethod (POST)
|
|
|
+ * @param id $id 删除id
|
|
|
+ * @param string $password 密码
|
|
|
+ * @param string $repassword 确认密码
|
|
|
+ */
|
|
|
+ public function son_edit()
|
|
|
+ {
|
|
|
+ $del_id = $this->request->post('id');
|
|
|
+ $password = $this->request->post('password');
|
|
|
+ $repassword = $this->request->post('repassword');
|
|
|
+
|
|
|
+ if (!$del_id || !$password || !$repassword) {
|
|
|
+ $this->error(__('Invalid parameters'));
|
|
|
+ }
|
|
|
+ if ($password != $repassword) {
|
|
|
+ $this->error('密码和确认密码不一致!');
|
|
|
+ }
|
|
|
+
|
|
|
+ $edit_user = ModelUser::where('id', $del_id)->where('pid', $this->auth->id)->find();
|
|
|
+ if(!$edit_user){
|
|
|
+ $this->error("账户不存在");
|
|
|
+ }
|
|
|
+ $edit_user->password = $password;
|
|
|
+ $edit_user->save();
|
|
|
+ $this->success("修改成功");
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 子账户列表
|
|
|
*
|