作者 yangfu

fix

1 appname = 能力展示 1 appname = 能力展示
2 httpport = 8080 2 httpport = 8080
3 -runmode = dev 3 +runmode = prod
4 4
5 #没设置的话 this.Ctx.Input.RequestBody 没有值 5 #没设置的话 this.Ctx.Input.RequestBody 没有值
6 copyrequestbody = true 6 copyrequestbody = true
1 [prod] 1 [prod]
2 #数据库相关 2 #数据库相关
3 -data_source = "root:123456@tcp(127.0.0.1:3306)/ability_display?loc=Local" 3 +data_source = "root:123456@tcp(192.168.100.102:3306)/ability_display?loc=Local"
4 4
5 5
6 #redis相关配置 6 #redis相关配置
7 -redis_add_port = "127.0.0.1:6379"  
8 -redis_auth = "123456" 7 +redis_add_port = "192.168.100.102:6379"
  8 +redis_auth = "123456"
9 9
10 #sms相关配置 10 #sms相关配置
11 yunpian_sms_sdk_url ="https://sms.yunpian.com/v2/sms/single_send.json" 11 yunpian_sms_sdk_url ="https://sms.yunpian.com/v2/sms/single_send.json"
@@ -66,6 +66,12 @@ func (this *BaseController) Valid(obj interface{}) (result bool, msg *protocol.R @@ -66,6 +66,12 @@ func (this *BaseController) Valid(obj interface{}) (result bool, msg *protocol.R
66 return 66 return
67 } 67 }
68 68
  69 +func (this *BaseController) Resp(msg *protocol.ResponseMessage) {
  70 +
  71 + this.Data["json"] = msg
  72 + this.ServeJSON()
  73 +}
  74 +
69 //GenMessage genarate a response message 75 //GenMessage genarate a response message
70 // func (this *BaseController) GenMessage(rsp interface{}, err error) *protocol.ResponseMessage { 76 // func (this *BaseController) GenMessage(rsp interface{}, err error) *protocol.ResponseMessage {
71 // var msg *protocol.ResponseMessage 77 // var msg *protocol.ResponseMessage
@@ -3,11 +3,11 @@ package v1 @@ -3,11 +3,11 @@ package v1
3 import ( 3 import (
4 "ability/protocol" 4 "ability/protocol"
5 5
6 - "gitlab.fjmaimaimai.com/mmm-go/gocomm/pkg/mybeego" 6 + "ability/controllers"
7 ) 7 )
8 8
9 type UserController struct { 9 type UserController struct {
10 - mybeego.BaseController 10 + controllers.BaseController
11 } 11 }
12 12
13 //匹配的是路由 13 //匹配的是路由
@@ -30,8 +30,8 @@ func init() { @@ -30,8 +30,8 @@ func init() {
30 }) 30 })
31 err := redis.InitWithDb(100, beego.AppConfig.String("redis_add_port"), beego.AppConfig.String("redis_auth"), "0") 31 err := redis.InitWithDb(100, beego.AppConfig.String("redis_add_port"), beego.AppConfig.String("redis_auth"), "0")
32 if err != nil { 32 if err != nil {
33 - log.Fatal(err)  
34 - panic(err) 33 + log.Fatal(err,beego.AppConfig.String("redis_add_port"),beego.AppConfig.String("redis_auth"))
  34 + //panic(err)
35 } 35 }
36 orm.NewBeeormEngine(config.Mysql{ 36 orm.NewBeeormEngine(config.Mysql{
37 DataSource: beego.AppConfig.String("data_source"), 37 DataSource: beego.AppConfig.String("data_source"),
@@ -2,7 +2,7 @@ @@ -2,7 +2,7 @@
2 2
3 echo "begin run $1" 3 echo "begin run $1"
4 # 以后台方式启动程序,并且将日志记录到 app.log 4 # 以后台方式启动程序,并且将日志记录到 app.log
5 -./$1 >> tmp.log 2>&1 & 5 +nohup ./$1 >> tmp.log 2>&1 &
6 pid=`ps -C $1 -o pid=` 6 pid=`ps -C $1 -o pid=`
7 7
8 if [ -n "$pid" ]; then 8 if [ -n "$pid" ]; then