作者 yangfu

fix

appname = 能力展示
httpport = 8080
runmode = dev
runmode = prod
#没设置的话 this.Ctx.Input.RequestBody 没有值
copyrequestbody = true
... ...
[prod]
#数据库相关
data_source = "root:123456@tcp(127.0.0.1:3306)/ability_display?loc=Local"
data_source = "root:123456@tcp(192.168.100.102:3306)/ability_display?loc=Local"
#redis相关配置
redis_add_port = "127.0.0.1:6379"
redis_auth = "123456"
redis_add_port = "192.168.100.102:6379"
redis_auth = "123456"
#sms相关配置
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
return
}
func (this *BaseController) Resp(msg *protocol.ResponseMessage) {
this.Data["json"] = msg
this.ServeJSON()
}
//GenMessage genarate a response message
// func (this *BaseController) GenMessage(rsp interface{}, err error) *protocol.ResponseMessage {
// var msg *protocol.ResponseMessage
... ...
... ... @@ -3,11 +3,11 @@ package v1
import (
"ability/protocol"
"gitlab.fjmaimaimai.com/mmm-go/gocomm/pkg/mybeego"
"ability/controllers"
)
type UserController struct {
mybeego.BaseController
controllers.BaseController
}
//匹配的是路由
... ...
... ... @@ -30,8 +30,8 @@ func init() {
})
err := redis.InitWithDb(100, beego.AppConfig.String("redis_add_port"), beego.AppConfig.String("redis_auth"), "0")
if err != nil {
log.Fatal(err)
panic(err)
log.Fatal(err,beego.AppConfig.String("redis_add_port"),beego.AppConfig.String("redis_auth"))
//panic(err)
}
orm.NewBeeormEngine(config.Mysql{
DataSource: beego.AppConfig.String("data_source"),
... ...
... ... @@ -2,7 +2,7 @@
echo "begin run $1"
# 以后台方式启动程序,并且将日志记录到 app.log
./$1 >> tmp.log 2>&1 &
nohup ./$1 >> tmp.log 2>&1 &
pid=`ps -C $1 -o pid=`
if [ -n "$pid" ]; then
... ...