|
|
@@ -3,6 +3,7 @@ namespace app\service\controller;
|
|
|
|
|
|
class Services extends Base
|
|
|
{
|
|
|
+ //客服信息
|
|
|
public function index()
|
|
|
{
|
|
|
$token = input("param.token/s");
|
|
|
@@ -14,11 +15,59 @@ class Services extends Base
|
|
|
//客服信息
|
|
|
$service = db('users')->where('id',$user_id )->select();
|
|
|
//print_r($service);exit;
|
|
|
- $this->assign([
|
|
|
- 'service' => $service,
|
|
|
- ]);
|
|
|
+ return $service;
|
|
|
+ }
|
|
|
+
|
|
|
+ //用户信息
|
|
|
+ public function account()
|
|
|
+ {
|
|
|
+ if(request()->isPost()) {
|
|
|
+ $account_id = input("param.account_id/s");
|
|
|
+ //客服信息
|
|
|
+ $account = db('accounts')->where('id', $account_id)->select();
|
|
|
+
|
|
|
+ return $account;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //修改/新增用户信息
|
|
|
+ public function update()
|
|
|
+ {
|
|
|
+ if(request()->isPost()) {
|
|
|
+ $account_id = input("param.account_id/s");
|
|
|
+ $account_name = input("param.account_name/s");
|
|
|
+ $account_email = input("param.account_email/s");
|
|
|
+ $phone = input("param.phone/s");
|
|
|
+ $address = input("param.address/s");
|
|
|
+ $label = input("param.label/s");
|
|
|
+ $remark = input("param.remark/s");
|
|
|
|
|
|
- return $this->fetch();
|
|
|
+
|
|
|
+ $param = [
|
|
|
+ 'account_name' => $account_name,
|
|
|
+ 'account_email' => $account_email,
|
|
|
+ 'phone' => $phone,
|
|
|
+ 'address' => $address,
|
|
|
+ 'label' => $label,
|
|
|
+ 'remark' => $remark
|
|
|
+ ];
|
|
|
+
|
|
|
+ $account = db('accounts')->where('id', $account_id)->select();
|
|
|
+ if(!empty($account)){
|
|
|
+ try{
|
|
|
+ db('accounts')->where('id', $account_id)->update($param);
|
|
|
+ }catch(\Exception $e){
|
|
|
+ return json(['code' => -1, 'data' => '', 'msg' => $e->getMessage()]);
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ try{
|
|
|
+ db('accounts')->insertGetId($param);
|
|
|
+ }catch(\Exception $e){
|
|
|
+ return json(['code' => -2, 'data' => '', 'msg' => $e->getMessage()]);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return json(['code' => 1, 'data' => '', 'msg' => '保存成功']);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
// 客服信息修改
|