|
@@ -4,6 +4,7 @@ import ( |
|
@@ -4,6 +4,7 @@ import ( |
|
4
|
"errors"
|
4
|
"errors"
|
|
5
|
|
5
|
|
|
6
|
"github.com/astaxie/beego/logs"
|
6
|
"github.com/astaxie/beego/logs"
|
|
|
|
7
|
+ companyService "gitlab.fjmaimaimai.com/mmm-go/partnermg/pkg/application/company/service"
|
|
7
|
"gitlab.fjmaimaimai.com/mmm-go/partnermg/pkg/domain"
|
8
|
"gitlab.fjmaimaimai.com/mmm-go/partnermg/pkg/domain"
|
|
8
|
)
|
9
|
)
|
|
9
|
|
10
|
|
|
@@ -37,6 +38,40 @@ func (c *CompanyController) SetPhone() { |
|
@@ -37,6 +38,40 @@ func (c *CompanyController) SetPhone() { |
|
37
|
c.ResponseError(errors.New("json数据解析失败"))
|
38
|
c.ResponseError(errors.New("json数据解析失败"))
|
|
38
|
return
|
39
|
return
|
|
39
|
}
|
40
|
}
|
|
|
|
41
|
+ switch param.Type {
|
|
|
|
42
|
+ case 1:
|
|
|
|
43
|
+ c.editPhone(param.Phone)
|
|
|
|
44
|
+ case 2:
|
|
|
|
45
|
+ c.getPhone()
|
|
|
|
46
|
+ default:
|
|
|
|
47
|
+ c.ResponseError(errors.New("参数错误"))
|
|
|
|
48
|
+ }
|
|
|
|
49
|
+ return
|
|
|
|
50
|
+}
|
|
|
|
51
|
+
|
|
|
|
52
|
+func (c *CompanyController) getPhone() {
|
|
|
|
53
|
+ companyid := c.GetUserCompany()
|
|
|
|
54
|
+ srv := companyService.NewCompanyService(nil)
|
|
|
|
55
|
+ data, err := srv.GetCompanyData(companyid)
|
|
|
|
56
|
+ if err != nil {
|
|
|
|
57
|
+ c.ResponseError(err)
|
|
|
|
58
|
+ return
|
|
|
|
59
|
+ }
|
|
|
|
60
|
+ result := map[string]interface{}{
|
|
|
|
61
|
+ "phone": data.Phone,
|
|
|
|
62
|
+ }
|
|
|
|
63
|
+ c.ResponseData(result)
|
|
|
|
64
|
+ return
|
|
|
|
65
|
+}
|
|
|
|
66
|
+
|
|
|
|
67
|
+func (c *CompanyController) editPhone(phone string) {
|
|
|
|
68
|
+ companyid := c.GetUserCompany()
|
|
|
|
69
|
+ srv := companyService.NewCompanyService(nil)
|
|
|
|
70
|
+ err := srv.UpdateCompanyPhone(companyid, phone)
|
|
|
|
71
|
+ if err != nil {
|
|
|
|
72
|
+ c.ResponseError(err)
|
|
|
|
73
|
+ return
|
|
|
|
74
|
+ }
|
|
40
|
c.ResponseData(nil)
|
75
|
c.ResponseData(nil)
|
|
41
|
return
|
76
|
return
|
|
42
|
} |
77
|
} |