|
@@ -79,7 +79,52 @@ class UserController extends Controller
|
|
return $this->showWarning('操作失败');
|
|
return $this->showWarning('操作失败');
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ *
|
|
|
|
+ * 修改
|
|
|
|
+ *
|
|
|
|
+ *
|
|
|
|
+ */
|
|
|
|
+ public function update(Request $request) {
|
|
|
|
+ $data = $this->repository->find($request->get('id'));
|
|
|
|
+ if($data->is_dealer == 1){
|
|
|
|
+ return $this->showWarning('该用户已成为经销商');
|
|
|
|
+ }
|
|
|
|
+ $save['is_dealer'] = 1;
|
|
|
|
+ $ok = $this->repository->update(request('id'),$save);
|
|
|
|
+
|
|
|
|
+ if($ok){
|
|
|
|
+ $add['store_id'] = $this->getStoreId();
|
|
|
|
+ $add['user_id'] = $data->id;
|
|
|
|
+ $add['name'] = $data->username;
|
|
|
|
+ $add['status'] = 1;
|
|
|
|
+ $res = AlbumAgentModel::create($add);
|
|
|
|
+ if($res) {
|
|
|
|
+ return $this->showMessage('操作成功');
|
|
|
|
+ }else{
|
|
|
|
+ return $this->showWarning('操作失败');
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 保存修改
|
|
|
|
+ */
|
|
|
|
+ private function _updateSave() {
|
|
|
|
+ $data = (array) request('data');
|
|
|
|
+ $ok = $this->repository->update(request('id'),$data);
|
|
|
|
+ if($ok) {
|
|
|
|
+ $url[] = array('url'=>U( 'Album/User/index'),'title'=>'返回列表');
|
|
|
|
+ return $this->showMessage('操作成功',urldecode(request('_referer')));
|
|
|
|
+ }else{
|
|
|
|
+ $url[] = array('url'=>U( 'Album/User/index'),'title'=>'返回列表');
|
|
|
|
+ return $this->showWarning('操作失败',$url);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 删除
|
|
* 删除
|
|
*/
|
|
*/
|