|
@@ -5,11 +5,7 @@ import (
|
|
|
"encoding/base64"
|
|
|
"encoding/json"
|
|
|
"fmt"
|
|
|
- "github.com/SKatiyar/qr"
|
|
|
- "github.com/baiy/Cadmin-server-go/admin"
|
|
|
- "github.com/baiy/Cadmin-server-go/system/utils"
|
|
|
"io/ioutil"
|
|
|
- "log"
|
|
|
"net/http"
|
|
|
qutil "qfw/util"
|
|
|
"qfw/util/redis"
|
|
@@ -17,10 +13,13 @@ import (
|
|
|
"time"
|
|
|
"util"
|
|
|
|
|
|
+ "github.com/SKatiyar/qr"
|
|
|
+ "github.com/baiy/Cadmin-server-go/admin"
|
|
|
+ "github.com/baiy/Cadmin-server-go/system/utils"
|
|
|
//"github.com/baiy/Cadmin-server-go/system/utils"
|
|
|
)
|
|
|
|
|
|
-//剑鱼伙伴列表
|
|
|
+// 剑鱼伙伴列表
|
|
|
func PartnerList(context *admin.Context) (interface{}, error) {
|
|
|
//接收前端参数
|
|
|
data := make(map[string]interface{})
|
|
@@ -85,17 +84,15 @@ func PartnerList(context *admin.Context) (interface{}, error) {
|
|
|
sql_c += " and p.name like " + "'" + "%" + param.Keyword + "%" + "'"
|
|
|
}
|
|
|
}
|
|
|
- log.Println(sql_c)
|
|
|
count := util.JysqlDB.CountBySql(sql_c)
|
|
|
sql += " order by p.createtime desc limit " + fmt.Sprint(param.Page.Offset) + " " + "," + " " + fmt.Sprint(param.Page.PageSize)
|
|
|
- log.Println(sql)
|
|
|
res := util.JysqlDB.SelectBySql(sql)
|
|
|
data["lists"] = res
|
|
|
data["total"] = count
|
|
|
return data, nil
|
|
|
}
|
|
|
|
|
|
-//剑鱼伙伴详情
|
|
|
+// 剑鱼伙伴详情
|
|
|
func PartnerInfo(context *admin.Context) (interface{}, error) {
|
|
|
//data := make(map[string]interface{})
|
|
|
param := new(struct {
|
|
@@ -126,7 +123,7 @@ func PartnerInfo(context *admin.Context) (interface{}, error) {
|
|
|
|
|
|
}
|
|
|
|
|
|
-//概览 四大分类订单销售统计
|
|
|
+// 概览 四大分类订单销售统计
|
|
|
func Overview(context *admin.Context) (interface{}, error) {
|
|
|
//不需要参数
|
|
|
param := new(struct {
|
|
@@ -145,7 +142,7 @@ func Overview(context *admin.Context) (interface{}, error) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-//佣金列表
|
|
|
+// 佣金列表
|
|
|
func CommissionList(context *admin.Context) (interface{}, error) {
|
|
|
data := make(map[string]interface{})
|
|
|
//接收参数
|
|
@@ -224,7 +221,6 @@ func CommissionList(context *admin.Context) (interface{}, error) {
|
|
|
sql += " order by s.createtime desc limit " + fmt.Sprint(param.Page.Offset) + "," + fmt.Sprint(param.Page.PageSize)
|
|
|
|
|
|
}
|
|
|
- log.Println(sql)
|
|
|
res := util.JysqlDB.SelectBySql(sql)
|
|
|
data["total"] = count
|
|
|
if param.Export {
|
|
@@ -236,7 +232,7 @@ func CommissionList(context *admin.Context) (interface{}, error) {
|
|
|
return data, nil
|
|
|
}
|
|
|
|
|
|
-//提现列表
|
|
|
+// 提现列表
|
|
|
func WithdrawList(context *admin.Context) (interface{}, error) {
|
|
|
param := new(struct {
|
|
|
utils.Page
|
|
@@ -275,7 +271,6 @@ func WithdrawList(context *admin.Context) (interface{}, error) {
|
|
|
str += sqlW
|
|
|
}
|
|
|
sql += " order by c.createtime desc limit " + fmt.Sprint(param.Page.Offset) + "," + fmt.Sprint(param.Page.PageSize)
|
|
|
- log.Println(sql)
|
|
|
count := util.JysqlDB.CountBySql(str)
|
|
|
res := util.JysqlDB.SelectBySql(sql)
|
|
|
data := make(map[string]interface{})
|
|
@@ -285,7 +280,7 @@ func WithdrawList(context *admin.Context) (interface{}, error) {
|
|
|
return data, nil
|
|
|
}
|
|
|
|
|
|
-//提现详情
|
|
|
+// 提现详情
|
|
|
func WithdrawDetail(context *admin.Context) (interface{}, error) {
|
|
|
param := new(struct {
|
|
|
Id int `form:"id"`
|
|
@@ -302,7 +297,6 @@ func WithdrawDetail(context *admin.Context) (interface{}, error) {
|
|
|
return res, nil
|
|
|
} else {
|
|
|
sql := "select c.id,p.name,c.name openBank,c.account,c.type,c.money,c.code,c.createtime,c.cashout_status from " + DisCashout + " c left join " + DisPartner + " p on c.uid = p.uid where c.id = ? "
|
|
|
- log.Println("sql", sql)
|
|
|
res := util.JysqlDB.SelectBySql(sql, param.Id)
|
|
|
if len(*res) != 0 {
|
|
|
return (*res)[0], nil
|
|
@@ -311,7 +305,7 @@ func WithdrawDetail(context *admin.Context) (interface{}, error) {
|
|
|
return nil, nil
|
|
|
}
|
|
|
|
|
|
-//结算列表
|
|
|
+// 结算列表
|
|
|
func SettleList(context *admin.Context) (interface{}, error) {
|
|
|
param := new(struct {
|
|
|
utils.Page
|
|
@@ -353,7 +347,6 @@ func SettleList(context *admin.Context) (interface{}, error) {
|
|
|
}
|
|
|
|
|
|
sql += " order by c.createtime desc limit " + fmt.Sprint(param.Page.Offset) + "," + fmt.Sprint(param.Page.PageSize)
|
|
|
- log.Println(sql)
|
|
|
res := util.JysqlDB.SelectBySql(sql)
|
|
|
count := util.JysqlDB.CountBySql(str)
|
|
|
data := map[string]interface{}{}
|
|
@@ -365,7 +358,7 @@ func SettleList(context *admin.Context) (interface{}, error) {
|
|
|
return data, nil
|
|
|
}
|
|
|
|
|
|
-//结算详情 // 接口文档没写
|
|
|
+// 结算详情 // 接口文档没写
|
|
|
func SettleDetails(context *admin.Context) (interface{}, error) {
|
|
|
|
|
|
param := new(struct {
|
|
@@ -384,7 +377,7 @@ func SettleDetails(context *admin.Context) (interface{}, error) {
|
|
|
return nil, nil
|
|
|
}
|
|
|
|
|
|
-//提现列表中--批量完成
|
|
|
+// 提现列表中--批量完成
|
|
|
func BatchFinish(context *admin.Context) (interface{}, error) {
|
|
|
param := new(struct {
|
|
|
Ids string `form:"ids"`
|
|
@@ -394,7 +387,6 @@ func BatchFinish(context *admin.Context) (interface{}, error) {
|
|
|
return nil, err
|
|
|
}
|
|
|
sql := "update " + DisCashout + " set cashout_status = 1 where id in (" + param.Ids + ")"
|
|
|
- log.Println(sql)
|
|
|
i := util.JysqlDB.UpdateOrDeleteBySql(sql)
|
|
|
if i > -1 {
|
|
|
return true, nil
|
|
@@ -427,7 +419,6 @@ func Finished(context *admin.Context) (interface{}, error) {
|
|
|
if sqlW != "" {
|
|
|
sql += sqlW
|
|
|
}
|
|
|
- log.Println(sql)
|
|
|
i := util.JysqlDB.UpdateOrDeleteBySql(sql)
|
|
|
if i > -1 {
|
|
|
return true, nil
|
|
@@ -435,7 +426,7 @@ func Finished(context *admin.Context) (interface{}, error) {
|
|
|
return false, nil
|
|
|
}
|
|
|
|
|
|
-//提现列表 -- 导出结果
|
|
|
+// 提现列表 -- 导出结果
|
|
|
func ExportResults(context *admin.Context) (interface{}, error) {
|
|
|
|
|
|
param := new(struct {
|
|
@@ -471,7 +462,6 @@ func ExportResults(context *admin.Context) (interface{}, error) {
|
|
|
}
|
|
|
|
|
|
sql += " order by c.createtime desc "
|
|
|
- log.Println(sql)
|
|
|
res := util.JysqlDB.SelectBySql(sql)
|
|
|
|
|
|
if len(*res) > 0 {
|
|
@@ -481,7 +471,7 @@ func ExportResults(context *admin.Context) (interface{}, error) {
|
|
|
return nil, nil
|
|
|
}
|
|
|
|
|
|
-//资金明细
|
|
|
+// 资金明细
|
|
|
func CapitalDetails(context *admin.Context) (interface{}, error) {
|
|
|
param := new(struct {
|
|
|
Uid string `form:"uid"`
|
|
@@ -518,7 +508,7 @@ func CapitalDetails(context *admin.Context) (interface{}, error) {
|
|
|
return resArr, nil
|
|
|
}
|
|
|
|
|
|
-//企业审核列表
|
|
|
+// 企业审核列表
|
|
|
func ExamineList(context *admin.Context) (interface{}, error) {
|
|
|
//接收前端参数
|
|
|
data := make(map[string]interface{})
|
|
@@ -543,17 +533,15 @@ func ExamineList(context *admin.Context) (interface{}, error) {
|
|
|
sql_c += " and p.name like " + "'" + "%" + param.Search + "%" + "'"
|
|
|
}
|
|
|
}
|
|
|
- log.Println(sql_c)
|
|
|
count := util.JysqlDB.CountBySql(sql_c)
|
|
|
sql += " order by p.createtime desc limit " + fmt.Sprint(param.Page.Offset) + " " + "," + " " + fmt.Sprint(param.Page.PageSize)
|
|
|
- log.Println(sql)
|
|
|
res := util.JysqlDB.SelectBySql(sql)
|
|
|
data["lists"] = res
|
|
|
data["total"] = count
|
|
|
return data, nil
|
|
|
}
|
|
|
|
|
|
-//审核操作
|
|
|
+// 审核操作
|
|
|
func PartnerExamine(context *admin.Context) (interface{}, error) {
|
|
|
//前台参数
|
|
|
param := new(struct {
|
|
@@ -567,7 +555,7 @@ func PartnerExamine(context *admin.Context) (interface{}, error) {
|
|
|
}
|
|
|
if param.Adopt == 1 || param.Adopt == 2 {
|
|
|
ok := util.JysqlDB.Update("dis_partner", map[string]interface{}{"id": param.Id, "type": 2}, map[string]interface{}{"is_adopt": param.Adopt, "reason": param.Reason, "adopt_time": time.Now().Format("2006-01-02 15:04:05")})
|
|
|
- if (param.Adopt == 1) {
|
|
|
+ if param.Adopt == 1 {
|
|
|
AddCommodity(param.Id)
|
|
|
}
|
|
|
if ok {
|
|
@@ -586,7 +574,7 @@ type Commodity struct {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-//新增商品管理
|
|
|
+// 新增商品管理
|
|
|
func AddCommodity(partnerId int) {
|
|
|
//获取所有商品
|
|
|
req, _ := http.NewRequest("GET", config.SysConfigs.Domain+"/jyMarketing/activity/findCommodityFirst", nil)
|
|
@@ -637,7 +625,7 @@ func AddCommodity(partnerId int) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-//企业列表
|
|
|
+// 企业列表
|
|
|
func EnterpriseList(context *admin.Context) (interface{}, error) {
|
|
|
data := make(map[string]interface{})
|
|
|
data["status"] = 0
|
|
@@ -648,7 +636,7 @@ func EnterpriseList(context *admin.Context) (interface{}, error) {
|
|
|
return data, nil
|
|
|
}
|
|
|
|
|
|
-//商品列表
|
|
|
+// 商品列表
|
|
|
func CommodityList(context *admin.Context) (interface{}, error) {
|
|
|
data := make(map[string]interface{})
|
|
|
data["status"] = 0
|
|
@@ -663,7 +651,6 @@ func CommodityList(context *admin.Context) (interface{}, error) {
|
|
|
commodityList := util.JysqlDB.Find("dis_commodity", map[string]interface{}{"partnerId": param.PartnerId}, "commodity,link,commodityCode,id,disWord", "", -1, -1)
|
|
|
for key, val := range *commodityList {
|
|
|
disWord := qutil.ObjToString(val["disWord"])
|
|
|
- log.Println(disWord)
|
|
|
if disWord[:1] == "A" {
|
|
|
(*commodityList)[key]["link"] = config.SysConfigs.Webdomain + "/weixin/frontPage/vipIntro/free/party?" + fmt.Sprint((*commodityList)[key]["disWord"]) + "_1"
|
|
|
} else if disWord[:1] == "E" {
|
|
@@ -678,7 +665,7 @@ func CommodityList(context *admin.Context) (interface{}, error) {
|
|
|
return data, nil
|
|
|
}
|
|
|
|
|
|
-//商品详情
|
|
|
+// 商品详情
|
|
|
func CommodityDetails(context *admin.Context) (interface{}, error) {
|
|
|
data := make(map[string]interface{})
|
|
|
data["status"] = 0
|
|
@@ -712,14 +699,14 @@ func CommodityDetails(context *admin.Context) (interface{}, error) {
|
|
|
return data, nil
|
|
|
}
|
|
|
|
|
|
-//获取二维码图片
|
|
|
-func DownloadJyAppQrOther(url string) (string) {
|
|
|
+// 获取二维码图片
|
|
|
+func DownloadJyAppQrOther(url string) string {
|
|
|
r, _ := qr.Encode(url, qr.M)
|
|
|
pngdat := r.PNG()
|
|
|
return base64.StdEncoding.EncodeToString(pngdat)
|
|
|
}
|
|
|
|
|
|
-//海报图片上传
|
|
|
+// 海报图片上传
|
|
|
func ImgUpload(context *admin.Context) (interface{}, error) {
|
|
|
data := make(map[string]interface{})
|
|
|
data["status"] = 0
|