123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- package frontc
- import(
- "wuyebaoxiuapi/models/frontm"
- )
- type RepairController struct {
- BaseController
- }
- // 用户报修
- func (this *RepairController)Repair() {
- this.Prepare()
- repair := new(frontm.Repair)
- image := this.GetString("image")
- repair.School = this.GetString("school")
- repair.Position = this.GetString("position")
- repair.ApplicantName = this.GetString("applicant_name")
- repair.ApplicantPhone = this.GetString("applicant_phone")
- repair.ApplicantContent = this.GetString("applicant_content")
- repair.Address = this.GetString("address")
- repair.ApplicantUserId = this.userInfo.Id
- repair.Status = 1
- if image == "" {
- this.ajaxMsg(MSG_ERR,"请上传图片",nil)
- }
- if repair.School == "" {
- this.ajaxMsg(MSG_ERR,"请填写学校",nil)
- }
- if repair.Position == "" {
- this.ajaxMsg(MSG_ERR,"请填写位置",nil)
- }
- if repair.ApplicantName == "" {
- this.ajaxMsg(MSG_ERR,"请填写保修人的姓名",nil)
- }
- if repair.ApplicantPhone == "" {
- this.ajaxMsg(MSG_ERR,"请填写联系电话",nil)
- }
- //if false == libs.Validate().IsPhone(repair.ApplicantPhone){
- // this.ajaxMsg(MSG_ERR,"请填写正确的联系电话",nil)
- //}
- id,err := frontm.RepairAdd(repair)
- if err != nil {
- this.ajaxMsg(MSG_ERR,"系统繁忙,请稍后再试。",nil)
- }
- data := make(map[string]interface{})
- data["image"] = image
- data["repairId"] = id
- this.addPicture(data)
- this.ajaxMsg(MSG_OK,"报修成功",nil)
- }
|