|
@@ -0,0 +1,624 @@
|
|
|
+package manage
|
|
|
+
|
|
|
+import (
|
|
|
+ "github.com/go-xweb/xweb"
|
|
|
+ "gopkg.in/mgo.v2/bson"
|
|
|
+ mgo "qfw/util/mongodb"
|
|
|
+ "time"
|
|
|
+)
|
|
|
+
|
|
|
+
|
|
|
+type LoanAction struct {
|
|
|
+ *xweb.Action
|
|
|
+ validataPassword xweb.Mapper `xweb:"/manage/jy_loan/validatapassword"` //密码校验
|
|
|
+ telephone_interviews xweb.Mapper `xweb:"/manage/jyloan/telephoneinterviews"` //电话回访列表
|
|
|
+ return_visit_records xweb.Mapper `xweb:"/manage/jy_loan/returnvisitrecords"` //回访信息登记
|
|
|
+ evaluation xweb.Mapper `xweb:"/manage/jy_loan/evaluation"` //查询回访记录
|
|
|
+ evaluation_list xweb.Mapper `xweb:"/manage/jy_loan/evaluationlist"` //评估
|
|
|
+ evaluation_opinion xweb.Mapper `xweb:"/manage/jy_loan/evaluationopinion"` //评估意见
|
|
|
+ modify_password xweb.Mapper `xweb:"/manage/jy_loan/modifypassword"` //修改密码
|
|
|
+ clue_manage xweb.Mapper `xweb:"/manage/jy_loan/cluelist"` //线索管理列表
|
|
|
+ clue_save xweb.Mapper `xweb:"/manage/jy_loan/cluesave"` //线索保存
|
|
|
+ clue_show xweb.Mapper `xweb:"/manage/jy_loan/clueshow"` //线索展示
|
|
|
+ clue_detail xweb.Mapper `xweb:"/manage/jy_loan/cluedetail"` //分类详情
|
|
|
+ classification_list xweb.Mapper `xweb:"/manage/jy_loan/classificationlist"` //分类列表
|
|
|
+ show_classification xweb.Mapper `xweb:"/manage/jy_loan/showclassification"` //查看分类
|
|
|
+ save_classification xweb.Mapper `xweb:"/manage/jy_loan/saveclassification"` //保存分类
|
|
|
+ updata_classification xweb.Mapper `xweb:"/manage/jy_loan/updataclassification"` //更新分类
|
|
|
+}
|
|
|
+
|
|
|
+type Front struct {
|
|
|
+ *xweb.Action
|
|
|
+ login xweb.Mapper `xweb:"/manage/jyloan/list"`
|
|
|
+ visitList xweb.Mapper `xweb:"/manage/loan/visitlist"`
|
|
|
+ evaluationlist xweb.Mapper `xweb:"/manage/loan/evaluationlist"` //评估列表页面
|
|
|
+ evaluationdetail xweb.Mapper `xweb:"/manage/jy_loan/evaluationdetail"` //评估详情页面
|
|
|
+ clasifylist xweb.Mapper `xweb:"/manage/loan/clasifylist"`
|
|
|
+ setting xweb.Mapper `xweb:"/manage/loan/setting"`
|
|
|
+ classset xweb.Mapper `xweb:"/manage/loan/classSet.html"`
|
|
|
+ passwordchange xweb.Mapper `xweb:"/loan/passwordChange.html"`
|
|
|
+ clue xweb.Mapper `xweb:"/manage/loan/cluelist"`
|
|
|
+ show_clue xweb.Mapper `xweb:"/manage/jy_loan/show_clue"`
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+func init(){
|
|
|
+ xweb.AddAction(&Front{})
|
|
|
+ xweb.AddAction(&LoanAction{})
|
|
|
+}
|
|
|
+
|
|
|
+func (this *Front)Login()error{
|
|
|
+ return this.Render("/manage/loan/manage.html")
|
|
|
+}
|
|
|
+
|
|
|
+func (this *Front)VisitList()error{
|
|
|
+ return this.Render("/manage/loan/visit.html")
|
|
|
+}
|
|
|
+
|
|
|
+func (this *Front)Evaluationlist()error{
|
|
|
+ return this.Render("/manage/loan/evaluationlist.html")
|
|
|
+}
|
|
|
+
|
|
|
+func (this *Front)Evaluationdetail()error{
|
|
|
+ uid := this.GetString("uid")
|
|
|
+ this.T["uid"] = uid
|
|
|
+ return this.Render("/manage/loan/evaluationdetail.html",&this.T)
|
|
|
+}
|
|
|
+func (this *Front)Setting()error{
|
|
|
+ return this.Render("/manage/loan/classSet.html")
|
|
|
+}
|
|
|
+
|
|
|
+//func (this *Front)Classset()error{
|
|
|
+// return this.Render("./classSet.html")
|
|
|
+//}
|
|
|
+
|
|
|
+func (this *Front)Passwordchange()error{
|
|
|
+ return this.Render("./passwordChange.html")
|
|
|
+}
|
|
|
+
|
|
|
+func (this *Front)Clue()error{
|
|
|
+ return this.Render("./manage/loan/cluelist.html")
|
|
|
+}
|
|
|
+
|
|
|
+func (this *Front)Clasifylist()error{
|
|
|
+ uid := this.GetString("uid")
|
|
|
+ this.T["uid"] = uid
|
|
|
+ return this.Render("./manage/loan/clue.html",&this.T)
|
|
|
+
|
|
|
+}
|
|
|
+func (this *Front)Show_clue()error{
|
|
|
+ uid := this.GetString("uid")
|
|
|
+ this.T["uid"] = uid
|
|
|
+ return this.Render("./manage/loan/show_clue.html")
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+//回访记录
|
|
|
+func (this *LoanAction)Evaluation(){
|
|
|
+ userId := this.GetSession("userId")
|
|
|
+ if userId==nil{
|
|
|
+ this.ServeJson(map[string]interface{}{
|
|
|
+ "error_code":"1004",
|
|
|
+ })
|
|
|
+ }else{
|
|
|
+ uid := this.GetString("uid")
|
|
|
+ query := make(map[string]interface{})
|
|
|
+ query["uid"] = uid
|
|
|
+ data :=*mgo.FindOne("jy_loan",query)
|
|
|
+ this.ServeJson(map[string][]interface{}{
|
|
|
+ "data":[]interface{}{
|
|
|
+ data,
|
|
|
+ },
|
|
|
+
|
|
|
+ })
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+//密码校验(业务密码,管理密码)
|
|
|
+func (this *LoanAction)ValidataPassword(){
|
|
|
+ userId := this.GetSession("userId")
|
|
|
+ if userId==nil{
|
|
|
+ this.ServeJson(map[string]interface{}{
|
|
|
+ "error_code":"1004",
|
|
|
+ })
|
|
|
+ }else{
|
|
|
+ pwd:=this.GetString("password")
|
|
|
+ pwd_type := this.GetString("type")
|
|
|
+ res:=valida(userId.(string),pwd,pwd_type)
|
|
|
+ data := make(map[string]interface{})
|
|
|
+ if res{
|
|
|
+ data["status"] = 1
|
|
|
+ this.ServeJson(map[string]interface{}{
|
|
|
+ "error_code":"0",
|
|
|
+ "data":data,
|
|
|
+ })
|
|
|
+ }else{
|
|
|
+ data["status"] = 0
|
|
|
+ this.ServeJson(map[string]interface{}{
|
|
|
+ "error_code":"0",
|
|
|
+ "data":data,
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+//电话回访列表
|
|
|
+func (this *LoanAction)Telephone_interviews(){
|
|
|
+ userId := this.GetSession("userId")
|
|
|
+ if userId==nil{
|
|
|
+ this.ServeJson(map[string]interface{}{
|
|
|
+ "error_code":"1004",
|
|
|
+ })
|
|
|
+ }else{
|
|
|
+ currentPage, _ := this.GetInteger("currentPage")
|
|
|
+ perPage, _ := this.GetInteger("perPage")
|
|
|
+ query := make(map[string]interface{})
|
|
|
+ query["visit_back"] = 0
|
|
|
+ ldata:=mgo.Find("jy_loan",query,`{"application_time":1}`,nil,false,(currentPage-1)*perPage, perPage)
|
|
|
+ count := mgo.Count("jy_loan", query)
|
|
|
+ data := make(map[string]interface{})
|
|
|
+ if len(*ldata)!=0{
|
|
|
+ this.ServeJson(map[string]interface{}{
|
|
|
+ "currentPage": currentPage,
|
|
|
+ "data": ldata,
|
|
|
+ "totalRows": count,
|
|
|
+ })
|
|
|
+ }else{
|
|
|
+ data["status"] = 0
|
|
|
+ this.ServeJson(map[string]interface{}{
|
|
|
+ "error_code":"0",
|
|
|
+ "data":data,
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+//回访记录登记
|
|
|
+func (this *LoanAction)Return_visit_records(){
|
|
|
+ userId := this.GetSession("userId")
|
|
|
+ if userId==nil{
|
|
|
+ this.ServeJson(map[string]interface{}{
|
|
|
+ "error_code":"1004",
|
|
|
+ })
|
|
|
+ }else{
|
|
|
+ data := make(map[string]int)
|
|
|
+ visit_msg := this.GetString("msg")
|
|
|
+ visit_person := this.GetString("person")
|
|
|
+ uid := this.GetString("uid")
|
|
|
+ if visit_msg!=""{
|
|
|
+ query := make(map[string]interface{})
|
|
|
+ query["uid"] = uid
|
|
|
+ info:= make(map[string]interface{})
|
|
|
+ set:= make(map[string]interface{})
|
|
|
+
|
|
|
+ if visit_person!=""{
|
|
|
+ info["visit_person"] = visit_person
|
|
|
+ }
|
|
|
+
|
|
|
+ info["visit_msg"] = visit_msg
|
|
|
+ info["visit_back"] = 1
|
|
|
+ info["visit_time"] = time.Now().Format("2006-01-02")
|
|
|
+ set["$set"] = info
|
|
|
+
|
|
|
+ res := mgo.Update("jy_loan",query,set,true,false)
|
|
|
+ if res{
|
|
|
+ data["status"] = 1
|
|
|
+ this.ServeJson(map[string]interface{}{
|
|
|
+ "error_code":"0",
|
|
|
+ "data":data,
|
|
|
+ })
|
|
|
+ }else{
|
|
|
+ data["status"] = 0
|
|
|
+ this.ServeJson(map[string]interface{}{
|
|
|
+ "error_code":"0",
|
|
|
+ "data":data,
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ data["status"] = 0
|
|
|
+ this.ServeJson(map[string]interface{}{
|
|
|
+ "error_code":"1002",
|
|
|
+ "data":data,
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
+//贷款评估列表
|
|
|
+func (this *LoanAction)Evaluation_list(){
|
|
|
+ userId := this.GetSession("userId")
|
|
|
+ if userId==nil{
|
|
|
+ this.ServeJson(map[string]interface{}{
|
|
|
+ "error_code":"1004",
|
|
|
+ })
|
|
|
+ }else{
|
|
|
+ currentPage, _ := this.GetInteger("currentPage")
|
|
|
+ perPage, _ := this.GetInteger("perPage")
|
|
|
+ query :=make(map[string]interface{})
|
|
|
+ query["opinion"] = 0
|
|
|
+ ldata:=*mgo.Find("jy_loan",query,`{"application_time":1}`,nil,false,(currentPage-1)*perPage, perPage)
|
|
|
+ count := mgo.Count("jy_loan", query)
|
|
|
+ data := make(map[string]interface{})
|
|
|
+ if len(ldata)!=0{
|
|
|
+ this.ServeJson(map[string]interface{}{
|
|
|
+ "currentPage": currentPage,
|
|
|
+ "data": ldata,
|
|
|
+ "totalRows": count,
|
|
|
+ })
|
|
|
+
|
|
|
+ }else{
|
|
|
+ data["status"] = 0
|
|
|
+ this.ServeJson(map[string]interface{}{
|
|
|
+ "error_code":"0",
|
|
|
+ "data":data,
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
+//线索管理
|
|
|
+func (this *LoanAction)Clue_manage(){
|
|
|
+ userId := this.GetSession("userId")
|
|
|
+ if userId == nil{
|
|
|
+ this.ServeJson(map[string]interface{}{
|
|
|
+ "error_code":"1004",
|
|
|
+ })
|
|
|
+ }else{
|
|
|
+ currentPage, _ := this.GetInteger("currentPage")
|
|
|
+ perPage, _ := this.GetInteger("perPage")
|
|
|
+ data :=mgo.Find("jy_loan",nil,`{"application_time":1}`,`{"companyName":1,"registration":1,"visit_person":1,"visit_time":1,"account_manager":1,"opinion_time":1,"classify_type":1,"uid":1}`,false,(currentPage-1)*perPage, perPage)
|
|
|
+ count := mgo.Count("jy_loan",nil)
|
|
|
+ if (*data!=nil){
|
|
|
+ this.ServeJson(map[string]interface{}{
|
|
|
+ "currentPage": currentPage,
|
|
|
+ "data": data,
|
|
|
+ "totalRows": count,
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+//贷款评估意见
|
|
|
+func (this *LoanAction)Evaluation_opinion(){
|
|
|
+ userId := this.GetSession("userId")
|
|
|
+ if userId==nil{
|
|
|
+ this.ServeJson(map[string]interface{}{
|
|
|
+ "error_code":"1004",
|
|
|
+ })
|
|
|
+ }else{
|
|
|
+ data := make(map[string]int)
|
|
|
+ loan_msg := this.GetString("opinion_msg")
|
|
|
+ account_manager := this.GetString("account_manager")
|
|
|
+ uid := this.GetString("uid")
|
|
|
+ if loan_msg!=""{
|
|
|
+ query := make(map[string]interface{})
|
|
|
+ query["uid"] = uid
|
|
|
+ info:= make(map[string]interface{})
|
|
|
+ set:= make(map[string]interface{})
|
|
|
+
|
|
|
+ if account_manager!=""{
|
|
|
+ info["account_manager"] = account_manager
|
|
|
+ }
|
|
|
+
|
|
|
+ info["opinion_msg"] = loan_msg
|
|
|
+ info["opinion_time"] = time.Now().Format("2006-01-02")
|
|
|
+ info["opinion"] = 1
|
|
|
+ set["$set"] = info
|
|
|
+
|
|
|
+ res := mgo.Update("jy_loan",query,set,true,false)
|
|
|
+ if res{
|
|
|
+ data["status"] = 1
|
|
|
+ this.ServeJson(map[string]interface{}{
|
|
|
+ "error_code":"0",
|
|
|
+ "data":data,
|
|
|
+ })
|
|
|
+ }else{
|
|
|
+ data["status"] = 0
|
|
|
+ this.ServeJson(map[string]interface{}{
|
|
|
+ "error_code":"0",
|
|
|
+ "data":data,
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ data["status"] = 0
|
|
|
+ this.ServeJson(map[string]interface{}{
|
|
|
+ "error_code":"1002",
|
|
|
+ "data":data,
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
+//修改密码
|
|
|
+func (this *LoanAction)Modify_password(){
|
|
|
+ userId := this.GetSession("userId")
|
|
|
+ if userId ==nil{
|
|
|
+ this.ServeJson(map[string]interface{}{
|
|
|
+ "error_code":"1004",
|
|
|
+ })
|
|
|
+ }else{
|
|
|
+ ptype := this.GetString("type")
|
|
|
+ pwd := this.GetString("password")
|
|
|
+ query:=make(map[string]interface{})
|
|
|
+ set := make(map[string]interface{})
|
|
|
+ t := make(map[string]string)
|
|
|
+ t["password"] = pwd
|
|
|
+ set["$set"] = t
|
|
|
+ query["uid"] = userId
|
|
|
+ query["mtype"] = ptype
|
|
|
+ res :=mgo.Update("loan_pwd",query,set,false,false)
|
|
|
+ if res{
|
|
|
+ this.ServeJson(map[string]interface{}{
|
|
|
+ "error_code":0,
|
|
|
+ "data":map[string]interface{}{
|
|
|
+ "status":1,
|
|
|
+ },
|
|
|
+ })
|
|
|
+ }else{
|
|
|
+ this.ServeJson(map[string]interface{}{
|
|
|
+ "error_code":0,
|
|
|
+ "data":map[string]interface{}{
|
|
|
+ "status":0,
|
|
|
+ },
|
|
|
+
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
+//线索分类列表
|
|
|
+func (this *LoanAction)Classification_list(){
|
|
|
+ userId := this.GetSession("userId")
|
|
|
+ if userId==nil{
|
|
|
+ this.ServeJson(map[string]interface{}{
|
|
|
+ "error_code":"1004",
|
|
|
+ })
|
|
|
+ }else{
|
|
|
+ //per_page,_ := this.GetInteger("per_page")
|
|
|
+ //current_page,_ := this.GetInteger("page")
|
|
|
+ ldata:=*mgo.Find("jy_loan_classify",nil,nil,nil,false,0,10)
|
|
|
+ count := mgo.Count("jy_loan_classify", nil)
|
|
|
+ if len(ldata)!=0{
|
|
|
+ this.ServeJson(map[string]interface{}{
|
|
|
+ "error_code":"0",
|
|
|
+ "data":ldata,
|
|
|
+ "count":count,
|
|
|
+ })
|
|
|
+
|
|
|
+ }else{
|
|
|
+ this.ServeJson(map[string]interface{}{
|
|
|
+ "error_code":"0",
|
|
|
+ "data":"",
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+//线索分类详情
|
|
|
+func (this *LoanAction)Clue_detail(){
|
|
|
+ userId := this.GetSession("userId")
|
|
|
+ if userId == nil{
|
|
|
+ this.ServeJson(map[string]interface{}{
|
|
|
+ "error_code":"1004",
|
|
|
+ })
|
|
|
+ }else{
|
|
|
+ uid := this.GetString("uid")
|
|
|
+ query := make(map[string]interface{})
|
|
|
+ query["uid"] = uid
|
|
|
+ data :=mgo.FindOne("jy_loan",query)
|
|
|
+ if data!=nil{
|
|
|
+ this.ServeJson(map[string][]interface{}{
|
|
|
+ "data":[]interface{}{
|
|
|
+ data,
|
|
|
+ },
|
|
|
+
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+//线索保存
|
|
|
+func (this *LoanAction)Clue_save(){
|
|
|
+ userId := this.GetSession("userId")
|
|
|
+ if userId == nil{
|
|
|
+ this.ServeJson(map[string]interface{}{
|
|
|
+ "error_code":"1004",
|
|
|
+ })
|
|
|
+ }else{
|
|
|
+ uid := this.GetString("uid")
|
|
|
+ classify_msg := this.GetString("classify_msg")
|
|
|
+ classify_type := this.GetString("classify_type")
|
|
|
+ query := make(map[string]interface{})
|
|
|
+ query["uid"] = uid
|
|
|
+ set :=make(map[string]interface{})
|
|
|
+ info := make(map[string]interface{})
|
|
|
+ info["classify_msg"] = classify_msg
|
|
|
+ info["classify_type"] = classify_type
|
|
|
+ set["$set"] = info
|
|
|
+ res := mgo.Update("jy_loan",query,set,true,false)
|
|
|
+ if res{
|
|
|
+ this.ServeJson(map[string]interface{}{
|
|
|
+ "status":1,
|
|
|
+ })
|
|
|
+ }else{
|
|
|
+ this.ServeJson(map[string]interface{}{
|
|
|
+ "status":0,
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+//线索展示
|
|
|
+func (this *LoanAction)Clue_show(){
|
|
|
+ userId := this.GetSession("userId")
|
|
|
+ if userId == nil{
|
|
|
+ this.ServeJson(map[string]interface{}{
|
|
|
+ "error_code":"1004",
|
|
|
+ })
|
|
|
+ }else{
|
|
|
+ uid := this.GetString("uid")
|
|
|
+ query := make(map[string]interface{})
|
|
|
+ query["uid"] = uid
|
|
|
+ res:=mgo.FindOne("jy_loan",query)
|
|
|
+ if res!=nil{
|
|
|
+ this.ServeJson(map[string][]interface{}{
|
|
|
+ "data":[]interface{}{
|
|
|
+ res,
|
|
|
+ },
|
|
|
+
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+//查看线索分类
|
|
|
+func(this *LoanAction)Show_classification(){
|
|
|
+ userId := this.GetSession("userId")
|
|
|
+ if userId==nil{
|
|
|
+ this.ServeJson(map[string]interface{}{
|
|
|
+ "error_code":"1004",
|
|
|
+ })
|
|
|
+ }else{
|
|
|
+ res := mgo.Find("jy_loan_classify",nil,false,nil,false,0,10)
|
|
|
+ if len(*res) != 0{
|
|
|
+ this.ServeJson(map[string]interface{}{
|
|
|
+ "error_code":"0",
|
|
|
+ "data":map[string]interface{}{
|
|
|
+ "status":"1",
|
|
|
+ "data":res,
|
|
|
+ },
|
|
|
+ })
|
|
|
+
|
|
|
+ }else{
|
|
|
+ this.ServeJson(map[string]interface{}{
|
|
|
+ "error_code":"0",
|
|
|
+ "data":map[string]interface{}{
|
|
|
+ "status":"0",
|
|
|
+ },
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+//保存分类
|
|
|
+func (this *LoanAction)Save_classification(){
|
|
|
+ userId := this.GetSession("userId")
|
|
|
+ if userId== nil{
|
|
|
+ this.ServeJson(map[string]interface{}{
|
|
|
+ "error_code":"1004",
|
|
|
+ })
|
|
|
+ }else{
|
|
|
+ classify_type := this.GetString("type")
|
|
|
+ msg := this.GetString("msg")
|
|
|
+ uid := this.GetString("uid")
|
|
|
+ if msg == ""{
|
|
|
+ this.ServeJson(map[string]interface{}{
|
|
|
+ "error_code":"1002",
|
|
|
+ })
|
|
|
+ }else{
|
|
|
+ query := make(map[string]interface{})
|
|
|
+ query["uid"] = uid
|
|
|
+ t :=make(map[string]interface{})
|
|
|
+ t["msg"] = msg
|
|
|
+ t["mtype"] = classify_type
|
|
|
+ set := make(map[string]interface{})
|
|
|
+ set["$set"] = t
|
|
|
+ res :=mgo.Update("jy_loan_classify",query,set,false,false)
|
|
|
+ if res{
|
|
|
+ this.ServeJson(map[string]interface{}{
|
|
|
+ "error_code":"0",
|
|
|
+ "data":map[string]interface{}{
|
|
|
+ "status":"1",
|
|
|
+ },
|
|
|
+ })
|
|
|
+ }else{
|
|
|
+ this.ServeJson(map[string]interface{}{
|
|
|
+ "error_code":"0",
|
|
|
+ "data":map[string]interface{}{
|
|
|
+ "status":"0",
|
|
|
+ },
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
+//增加分类设置
|
|
|
+func (this *LoanAction)Updata_classification(){
|
|
|
+ userId := this.GetSession("userId")
|
|
|
+ if userId==nil{
|
|
|
+ this.ServeJson(map[string]interface{}{
|
|
|
+ "error_code":"1004",
|
|
|
+ })
|
|
|
+ }else {
|
|
|
+ classify_type := this.GetString("type")
|
|
|
+ uid := this.GetString("uid")
|
|
|
+ if classify_type == "add"{
|
|
|
+ category:=this.GetString("category")
|
|
|
+ description:=this.GetString("description")
|
|
|
+ t := make(map[string]interface{})
|
|
|
+ t["classify_type"] = category
|
|
|
+ t["discribe"] = description
|
|
|
+ res:=mgo.Save("jy_loan_classify",t)
|
|
|
+ if res!=""{
|
|
|
+ this.ServeJson(map[string]interface{}{
|
|
|
+ "error_code":"0",
|
|
|
+ "data":map[string]interface{}{
|
|
|
+ "status":"1",
|
|
|
+ },
|
|
|
+ })
|
|
|
+ }else{
|
|
|
+ this.ServeJson(map[string]interface{}{
|
|
|
+ "error_code":"0",
|
|
|
+ "data":map[string]interface{}{
|
|
|
+ "status":"0",
|
|
|
+ },
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+ }else{
|
|
|
+ m := make(map[string]interface{})
|
|
|
+ m["_id"] = bson.ObjectIdHex(uid)
|
|
|
+ err :=mgo.Del("jy_loan_classify",m)
|
|
|
+ if err{
|
|
|
+ this.ServeJson(map[string]interface{}{
|
|
|
+ "error_code":"0",
|
|
|
+ "data":map[string]interface{}{
|
|
|
+ "status":"1",
|
|
|
+ },
|
|
|
+ })
|
|
|
+ }else{
|
|
|
+ this.ServeJson(map[string]interface{}{
|
|
|
+ "error_code":"0",
|
|
|
+ "data":map[string]interface{}{
|
|
|
+ "status":"0",
|
|
|
+ },
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+func valida(uid,pwd,mtype string)bool{
|
|
|
+ query := make(map[string]interface{})
|
|
|
+ query["uid"] = uid
|
|
|
+ query["mtype"] = mtype
|
|
|
+ pdata:=*mgo.FindOneByField("loan_pwd",query,`{"password":1}`)
|
|
|
+ if pdata!=nil&&pdata["password"] == pwd{
|
|
|
+ return true
|
|
|
+ }else{
|
|
|
+ return false
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|