| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421 |
- package grpc
- import (
- "context"
- "encoding/json"
- pb "sportfitness/base/api/grpc/base"
- "sportfitness/base/assembly/base/service"
- "sportfitness/base/errors"
- "sportfitness/base/global"
- "strings"
- "time"
- "google.golang.org/grpc/metadata"
- )
- type Api struct {
- pb.UnimplementedApiServer
- }
- func (Api) getRemoteIp(ctx context.Context) string {
- if md, ok := metadata.FromIncomingContext(ctx); ok {
- ip := md.Get("x-forwarded-for")
- if len(ip) > 0 {
- return ip[0]
- }
- }
- return ""
- }
- func (Api) getUserAgent(ctx context.Context) string {
- if md, ok := metadata.FromIncomingContext(ctx); ok {
- agents := md.Get("user-agent")
- return strings.Join(agents, "\n")
- }
- return ""
- }
- func (Api) getToken(ctx context.Context) (token string) {
- if md, ok := metadata.FromIncomingContext(ctx); ok {
- sl := md.Get("Token")
- if len(sl) >= 1 {
- token = sl[0]
- }
- }
- return
- }
- func (Api) checkRs(rs string) bool {
- b := false
- rsMap := make(map[string]interface{})
- err := json.Unmarshal([]byte(rs), &rsMap)
- if err != nil {
- panic(errors.J2MError)
- }
- code := int(rsMap["code"].(float64))
- if code == 0 {
- b = true
- } else {
- b = false
- }
- return b
- }
- // webToGoVerify 前端入Go验证签名函数,只允许StandardRequest进行验证
- func (a Api) webToGoVerify(ctx context.Context, q *pb.StandardRequest) (string, *pb.StandardRequest, string) {
- token := a.getToken(ctx)
- //wtgStr = q.JsonStr
- wtgSign := q.Sign // 生成新签名
- return token, q, wtgSign
- }
- // courseToGoVerify 前端入Go验证签名函数,只允许StandardRequest进行验证
- func (a Api) courseToGoVerify(ctx context.Context, q *pb.CourseStandardRequest) (string, *pb.CourseStandardRequest, string) {
- token := a.getToken(ctx)
- //wtgStr = q.JsonStr
- wtgSign := q.Sign // 生成新签名
- return token, q, wtgSign
- }
- func (Api) goToWebSigner(content string) (gtwStr, gtwSign string) {
- gtwStr = content
- gtwSign = ""
- return
- }
- func (a Api) toWebFunc(content string) *pb.StandardReply {
- gtwStr, gtwSign := a.goToWebSigner(content) // 空函数,go透传给前台数据时生成签名
- return &pb.StandardReply{
- JsonRst: gtwStr,
- Sign: gtwSign,
- }
- }
- func (a Api) SignIn(ctx context.Context, q *pb.SignInRequest) (*pb.SignInReply, error) {
- token := service.User{}.SignInUserCodePassword(
- q.Name, q.Password, a.getRemoteIp(ctx), a.getUserAgent(ctx), q.CodeId, q.VerifyCode)
- return &pb.SignInReply{Token: token}, nil
- }
- func (a Api) GenVerifyImage(ctx context.Context, q *pb.GenVerifyImageRequest) (*pb.GenVerifyImageReply, error) {
- codeId, imageBase64 := service.User{}.GenVerifyImage(q.Height, q.Width)
- return &pb.GenVerifyImageReply{ImageBase64: imageBase64, CodeId: codeId}, nil
- }
- func (a Api) SignOut(ctx context.Context, q *pb.DefaultRequest) (*pb.DefaultReply, error) {
- token := a.getToken(ctx)
- service.User{}.SignOut(token)
- return &pb.DefaultReply{}, nil
- }
- //func (a Api) SignUpInWithPhone() {
- //
- //}
- // ----------------------- 商家信息管理 ---------------------------------------------
- // AcrossUserSimpleQuery 可跨店会员简单查询
- func (a Api) AcrossUserSimpleQuery(ctx context.Context, r *pb.StandardRequest) (*pb.StandardReply, error) {
- // 获取token,并验证签名函数
- token, q, sign := a.webToGoVerify(ctx, r)
- rs := service.User{}.AcrossUserSimpleQuery(token, q.ShopID, q.JsonStr, sign)
- rst := a.toWebFunc(rs)
- return rst, nil
- }
- // VipUserSimpleQuery 会员简单查询
- func (a Api) VipUserSimpleQuery(ctx context.Context, r *pb.StandardRequest) (*pb.StandardReply, error) {
- // 获取token,并验证签名函数
- token, q, sign := a.webToGoVerify(ctx, r)
- rs := service.User{}.VipUserSimpleQuery(token, q.ShopID, q.JsonStr, sign)
- rst := a.toWebFunc(rs)
- return rst, nil
- }
- // TempVipUserSimpleQuery 临时会员简单查询
- func (a Api) TempVipUserSimpleQuery(ctx context.Context, r *pb.StandardRequest) (*pb.StandardReply, error) {
- // 获取token,并验证签名函数
- token, q, sign := a.webToGoVerify(ctx, r)
- rs := service.User{}.TempVipUserSimpleQuery(token, q.ShopID, q.JsonStr, sign)
- rst := a.toWebFunc(rs)
- return rst, nil
- }
- // ClassSimpleQuery 课目简单查询
- func (a Api) ClassSimpleQuery(ctx context.Context, r *pb.StandardRequest) (*pb.StandardReply, error) {
- // 获取token,并验证签名函数
- token, q, sign := a.webToGoVerify(ctx, r)
- rs := service.Class{}.ClassSimpleQuery(token, q.ShopID, q.JsonStr, sign)
- rst := a.toWebFunc(rs)
- return rst, nil
- }
- // SelectHrSensors 心率带简单查询
- func (a Api) SelectHrSensors(ctx context.Context, r *pb.StandardRequest) (*pb.StandardReply, error) {
- // 获取token,并验证签名函数
- token, q, sign := a.webToGoVerify(ctx, r)
- rs := service.Hr{}.SelectHrSensors(token, q.ShopID, q.JsonStr, sign)
- rst := a.toWebFunc(rs)
- return rst, nil
- }
- // GroupSimpleQueryByShopID 商家分组简单查询-通过商家自己ID查询
- func (a Api) GroupSimpleQueryByShopID(ctx context.Context, r *pb.StandardRequest) (*pb.StandardReply, error) {
- // 获取token,并验证签名函数
- token, q, sign := a.webToGoVerify(ctx, r)
- rs := service.Shop{}.GroupSimpleQueryByShopID(token, q.ShopID, q.JsonStr, sign)
- rst := a.toWebFunc(rs)
- return rst, nil
- }
- // EqSimpleQuery 商家分组简单查询-通过商家自己ID查询
- func (a Api) EqSimpleQuery(ctx context.Context, r *pb.StandardRequest) (*pb.StandardReply, error) {
- // 获取token,并验证签名函数
- token, q, sign := a.webToGoVerify(ctx, r)
- rs := service.Shop{}.EqSimpleQuery(token, q.ShopID, q.JsonStr, sign)
- rst := a.toWebFunc(rs)
- return rst, nil
- }
- // ManageableSimpleQuery 商家管理员简单查询-通过商家自己ID查询
- func (a Api) ManageableSimpleQuery(ctx context.Context, r *pb.ManageableSimpleQueryRequest) (*pb.ManageableSimpleQueryReply, error) {
- token := a.getToken(ctx)
- rs := service.Shop{}.ManageableSimpleQuery(token, r.GetShopId())
- return rs, nil
- }
- // ----------------------- 商家信息管理 ---------------------------------------------
- func (a Api) ManageableShopList(ctx context.Context, r *pb.ShopListRequest) (*pb.ShopListReply, error) {
- token := a.getToken(ctx)
- rs := service.Shop{}.ManageableShopList(token, r)
- return rs, nil
- }
- func (a Api) ManageableGetShopInfo(ctx context.Context, r *pb.ShopDetailRequest) (*pb.ShopInfo, error) {
- token := a.getToken(ctx)
- rs := service.Shop{}.ManageableGetShopInfo(token, r)
- return rs, nil
- }
- func (a Api) ShopLicenseList(ctx context.Context, r *pb.ShopDetailRequest) (*pb.LicenseList, error) {
- token := a.getToken(ctx)
- rs := service.Shop{}.ShopLicenseList(token, r)
- return rs, nil
- }
- //func (a Api) ShopLicenseTypeMap(ctx context.Context, r *pb.IdList) (*pb.LicenseTypeMapReply, error) {
- // token := a.getToken(ctx)
- //
- // _ = service.Shop{}.LicenseTypeMap(token, r)
- //
- // return nil, nil
- //}
- // ShopGroupQuery 商家跨店分组查询
- func (a Api) ShopGroupQuery(ctx context.Context, r *pb.StandardRequest) (*pb.StandardReply, error) {
- // 获取token,并验证签名函数
- token, q, sign := a.webToGoVerify(ctx, r)
- rs := service.Shop{}.ShopGroupQuery(token, q.ShopID, q.JsonStr, sign)
- rst := a.toWebFunc(rs)
- return rst, nil
- }
- // GetShopNavi 查询商家栏目:分级查询,查询一级菜单parentId传入0
- func (a Api) GetShopNavi(ctx context.Context, r *pb.GetShopNaviRequest) (*pb.GetShopNaviReply, error) {
- token := a.getToken(ctx)
- rs := service.Shop{}.GetShopNavi(token, r)
- return rs, nil
- }
- // GetShopNaviAll 查询商家全部栏目
- func (a Api) GetShopNaviAll(ctx context.Context, r *pb.GetShopNaviAllRequest) (*pb.GetShopNaviAllReply, error) {
- token := a.getToken(ctx)
- rs := service.Shop{}.GetShopNaviAll(token, r)
- return rs, nil
- }
- // ShopGroupAdd 商家跨店分组添加
- func (a Api) ShopGroupAdd(ctx context.Context, r *pb.StandardRequest) (*pb.StandardReply, error) {
- // 获取token,并验证签名函数
- token, q, sign := a.webToGoVerify(ctx, r)
- rs := service.Shop{}.ShopGroupAdd(token, q.ShopID, q.JsonStr, sign)
- rst := a.toWebFunc(rs)
- return rst, nil
- }
- // ShopGroupEdit 商家跨店分组编辑
- func (a Api) ShopGroupEdit(ctx context.Context, r *pb.StandardRequest) (*pb.StandardReply, error) {
- // 获取token,并验证签名函数
- token, q, sign := a.webToGoVerify(ctx, r)
- rs := service.Shop{}.ShopGroupEdit(token, q.ShopID, q.JsonStr, sign)
- rst := a.toWebFunc(rs)
- return rst, nil
- }
- // ShopGroupStatusEdit 商家跨店分组状态修改
- func (a Api) ShopGroupStatusEdit(ctx context.Context, r *pb.StandardRequest) (*pb.StandardReply, error) {
- // 获取token,并验证签名函数
- token, q, sign := a.webToGoVerify(ctx, r)
- rs := service.Shop{}.ShopGroupStatusEdit(token, q.ShopID, q.JsonStr, sign)
- rst := a.toWebFunc(rs)
- return rst, nil
- }
- // ShopGroupDetailsQuery 跨店分组详情查询
- func (a Api) ShopGroupDetailsQuery(ctx context.Context, r *pb.StandardRequest) (*pb.StandardReply, error) {
- // 获取token,并验证签名函数
- token, q, sign := a.webToGoVerify(ctx, r)
- rs := service.Shop{}.ShopGroupDetailsQuery(token, q.ShopID, q.JsonStr, sign)
- rst := a.toWebFunc(rs)
- return rst, nil
- }
- // ShopVenueQuery 商家区域查询
- func (a Api) ShopVenueQuery(ctx context.Context, r *pb.StandardRequest) (*pb.StandardReply, error) {
- // 获取token,并验证签名函数
- token, q, sign := a.webToGoVerify(ctx, r)
- rs := service.Shop{}.ShopVenueQuery(token, q.ShopID, q.JsonStr, sign)
- rst := a.toWebFunc(rs)
- return rst, nil
- }
- // ShopVenueAdd 商家区域添加
- func (a Api) ShopVenueAdd(ctx context.Context, r *pb.StandardRequest) (*pb.StandardReply, error) {
- // 获取token,并验证签名函数
- token, q, sign := a.webToGoVerify(ctx, r)
- rs := service.Shop{}.ShopVenueAdd(token, q.ShopID, q.JsonStr, sign)
- rst := a.toWebFunc(rs)
- return rst, nil
- }
- // ShopVenueEdit 商家区域编辑
- func (a Api) ShopVenueEdit(ctx context.Context, r *pb.StandardRequest) (*pb.StandardReply, error) {
- // 获取token,并验证签名函数
- token, q, sign := a.webToGoVerify(ctx, r)
- rs := service.Shop{}.ShopVenueEdit(token, q.ShopID, q.JsonStr, sign)
- rst := a.toWebFunc(rs)
- return rst, nil
- }
- // ShopVenueStatusEdit 商家区域状态修改
- func (a Api) ShopVenueStatusEdit(ctx context.Context, r *pb.StandardRequest) (*pb.StandardReply, error) {
- // 获取token,并验证签名函数
- token, q, sign := a.webToGoVerify(ctx, r)
- rs := service.Shop{}.ShopVenueStatusEdit(token, q.ShopID, q.JsonStr, sign)
- rst := a.toWebFunc(rs)
- return rst, nil
- }
- // ShopVenueEquipQuery 商家设备查询
- func (a Api) ShopVenueEquipQuery(ctx context.Context, r *pb.StandardRequest) (*pb.StandardReply, error) {
- // 获取token,并验证签名函数
- token, q, sign := a.webToGoVerify(ctx, r)
- rs := service.Shop{}.ShopVenueEquipQuery(token, q.ShopID, q.JsonStr, sign)
- rst := a.toWebFunc(rs)
- return rst, nil
- }
- // ShopVenueEquipAdd 商家设备添加
- func (a Api) ShopVenueEquipAdd(ctx context.Context, r *pb.StandardRequest) (*pb.StandardReply, error) {
- // 获取token,并验证签名函数
- token, q, sign := a.webToGoVerify(ctx, r)
- rs := service.Shop{}.ShopVenueEquipAdd(token, q.ShopID, q.JsonStr, sign)
- rst := a.toWebFunc(rs)
- return rst, nil
- }
- // ShopVenueEquipEdit 商家设备编辑
- func (a Api) ShopVenueEquipEdit(ctx context.Context, r *pb.StandardRequest) (*pb.StandardReply, error) {
- // 获取token,并验证签名函数
- token, q, sign := a.webToGoVerify(ctx, r)
- rs := service.Shop{}.ShopVenueEquipEdit(token, q.ShopID, q.JsonStr, sign)
- rst := a.toWebFunc(rs)
- return rst, nil
- }
- // ShopVenueEquipStatusEdit 商家设备状态修改
- func (a Api) ShopVenueEquipStatusEdit(ctx context.Context, r *pb.StandardRequest) (*pb.StandardReply, error) {
- // 获取token,并验证签名函数
- token, q, sign := a.webToGoVerify(ctx, r)
- rs := service.Shop{}.ShopVenueEquipStatusEdit(token, q.ShopID, q.JsonStr, sign)
- rst := a.toWebFunc(rs)
- return rst, nil
- }
- // ShopVenueEquipStatusDel 商家设备删除
- func (a Api) ShopVenueEquipStatusDel(ctx context.Context, r *pb.StandardRequest) (*pb.StandardReply, error) {
- // 获取token,并验证签名函数
- token, q, sign := a.webToGoVerify(ctx, r)
- rs := service.Shop{}.ShopVenueEquipStatusEdit(token, q.ShopID, q.JsonStr, sign)
- rst := a.toWebFunc(rs)
- return rst, nil
- }
- // ShopConfigQuery 商家配置查询
- func (a Api) ShopConfigQuery(ctx context.Context, r *pb.StandardRequest) (*pb.StandardReply, error) {
- // 获取token,并验证签名函数
- token, q, sign := a.webToGoVerify(ctx, r)
- rs := service.Shop{}.ShopConfigQuery(token, q.ShopID, q.JsonStr, sign)
- rst := a.toWebFunc(rs)
- return rst, nil
- }
- // ShopConfigEdit 商家配置编辑
- func (a Api) ShopConfigEdit(ctx context.Context, r *pb.StandardRequest) (*pb.StandardReply, error) {
- // 获取token,并验证签名函数
- token, q, sign := a.webToGoVerify(ctx, r)
- rs := service.Shop{}.ShopConfigEdit(token, q.ShopID, q.JsonStr, sign)
- rst := a.toWebFunc(rs)
- return rst, nil
- }
- // --------------------------商家会员管理----------------------------------------------------
- // ShopVipUserQuery 商家会员查询
- func (a Api) ShopVipUserQuery(ctx context.Context, r *pb.StandardRequest) (*pb.StandardReply, error) {
- // 获取token,并验证签名函数
- token, q, sign := a.webToGoVerify(ctx, r)
- rs := service.User{}.ShopVipUserQuery(token, q.ShopID, q.JsonStr, sign)
- rst := a.toWebFunc(rs)
- return rst, nil
- }
- // ShopVipUserAdd 商家会员添加
- func (a Api) ShopVipUserAdd(ctx context.Context, r *pb.StandardRequest) (*pb.StandardReply, error) {
- // 获取token,并验证签名函数
- token, q, sign := a.webToGoVerify(ctx, r)
- rs := service.User{}.ShopVipUserAdd(token, q.ShopID, q.JsonStr, sign)
- rst := a.toWebFunc(rs)
- return rst, nil
- }
- // ShopVipUserEdit 商家会员编辑
- func (a Api) ShopVipUserEdit(ctx context.Context, r *pb.StandardRequest) (*pb.StandardReply, error) {
- // 获取token,并验证签名函数
- token, q, sign := a.webToGoVerify(ctx, r)
- rs := service.User{}.ShopVipUserEdit(token, q.ShopID, q.JsonStr, sign)
- rst := a.toWebFunc(rs)
- return rst, nil
- }
- // ShopVipUserStatusEdit 商家会员状态编辑
- func (a Api) ShopVipUserStatusEdit(ctx context.Context, r *pb.StandardRequest) (*pb.StandardReply, error) {
- // 获取token,并验证签名函数
- token, q, sign := a.webToGoVerify(ctx, r)
- rs := service.User{}.ShopVipUserStatusEdit(token, q.ShopID, q.JsonStr, sign)
- rst := a.toWebFunc(rs)
- return rst, nil
- }
- // AcrossVipUserQuery 跨店会员查询
- func (a Api) AcrossVipUserQuery(ctx context.Context, r *pb.StandardRequest) (*pb.StandardReply, error) {
- // 获取token,并验证签名函数
- token, q, sign := a.webToGoVerify(ctx, r)
- rs := service.User{}.AcrossVipUserQuery(token, q.ShopID, q.JsonStr, sign)
- rst := a.toWebFunc(rs)
- return rst, nil
- }
- // AcrossVipUserAdd 跨店会员添加
- func (a Api) AcrossVipUserAdd(ctx context.Context, r *pb.StandardRequest) (*pb.StandardReply, error) {
- // 获取token,并验证签名函数
- token, q, sign := a.webToGoVerify(ctx, r)
- rs := service.User{}.AcrossVipUserQuery(token, q.ShopID, q.JsonStr, sign)
- rst := a.toWebFunc(rs)
- return rst, nil
- }
- // AcrossVipUserDel 跨店会员删除
- func (a Api) AcrossVipUserDel(ctx context.Context, r *pb.StandardRequest) (*pb.StandardReply, error) {
- // 获取token,并验证签名函数
- token, q, sign := a.webToGoVerify(ctx, r)
- rs := service.User{}.AcrossVipUserDel(token, q.ShopID, q.JsonStr, sign)
- rst := a.toWebFunc(rs)
- return rst, nil
- }
- // VipPhoneQuery 商家会员手机号查询
- func (a Api) VipPhoneQuery(ctx context.Context, r *pb.StandardRequest) (*pb.StandardReply, error) {
- // 获取token,并验证签名函数
- token, q, sign := a.webToGoVerify(ctx, r)
- rs := service.User{}.VipPhoneQuery(token, q.ShopID, q.JsonStr, sign)
- rst := a.toWebFunc(rs)
- return rst, nil
- }
- // VipMainPhoneCheck 商家会员主手机号校验
- func (a Api) VipMainPhoneCheck(ctx context.Context, r *pb.StandardRequest) (*pb.StandardReply, error) {
- // 获取token,并验证签名函数
- token, q, sign := a.webToGoVerify(ctx, r)
- rs := service.User{}.VipMainPhoneCheck(token, q.ShopID, q.JsonStr, sign)
- rst := a.toWebFunc(rs)
- return rst, nil
- }
- // VipOtherPhoneAdd 商家会员其他手机号添加
- func (a Api) VipOtherPhoneAdd(ctx context.Context, r *pb.StandardRequest) (*pb.StandardReply, error) {
- // 获取token,并验证签名函数
- token, q, sign := a.webToGoVerify(ctx, r)
- rs := service.User{}.VipOtherPhoneAdd(token, q.ShopID, q.JsonStr, sign)
- rst := a.toWebFunc(rs)
- return rst, nil
- }
- // VipOtherPhoneEdit 商家会员其他手机号编辑
- func (a Api) VipOtherPhoneEdit(ctx context.Context, r *pb.StandardRequest) (*pb.StandardReply, error) {
- // 获取token,并验证签名函数
- token, q, sign := a.webToGoVerify(ctx, r)
- rs := service.User{}.VipOtherPhoneEdit(token, q.ShopID, q.JsonStr, sign)
- rst := a.toWebFunc(rs)
- return rst, nil
- }
- // VipOtherPhoneStatusEdit 商家会员其他手机号状态修改
- func (a Api) VipOtherPhoneStatusEdit(ctx context.Context, r *pb.StandardRequest) (*pb.StandardReply, error) {
- // 获取token,并验证签名函数
- token, q, sign := a.webToGoVerify(ctx, r)
- rs := service.User{}.VipOtherPhoneStatusEdit(token, q.ShopID, q.JsonStr, sign)
- rst := a.toWebFunc(rs)
- return rst, nil
- }
- // TempVipUserQuery 商家临时会员查询
- func (a Api) TempVipUserQuery(ctx context.Context, r *pb.StandardRequest) (*pb.StandardReply, error) {
- // 获取token,并验证签名函数
- token, q, sign := a.webToGoVerify(ctx, r)
- rs := service.User{}.TempVipUserQuery(token, q.ShopID, q.JsonStr, sign)
- rst := a.toWebFunc(rs)
- return rst, nil
- }
- // TempVipUserAdd 商家临时会员添加
- func (a Api) TempVipUserAdd(ctx context.Context, r *pb.StandardRequest) (*pb.StandardReply, error) {
- // 获取token,并验证签名函数
- token, q, sign := a.webToGoVerify(ctx, r)
- rs := service.User{}.TempVipUserAdd(token, q.ShopID, q.JsonStr, sign)
- rst := a.toWebFunc(rs)
- return rst, nil
- }
- // TempVipUserEdit 商家临时会员编辑
- func (a Api) TempVipUserEdit(ctx context.Context, r *pb.StandardRequest) (*pb.StandardReply, error) {
- // 获取token,并验证签名函数
- token, q, sign := a.webToGoVerify(ctx, r)
- rs := service.User{}.TempVipUserEdit(token, q.ShopID, q.JsonStr, sign)
- rst := a.toWebFunc(rs)
- return rst, nil
- }
- // TempVipUserStatusEdit 商家临时会员状态修改
- func (a Api) TempVipUserStatusEdit(ctx context.Context, r *pb.StandardRequest) (*pb.StandardReply, error) {
- // 获取token,并验证签名函数
- token, q, sign := a.webToGoVerify(ctx, r)
- rs := service.User{}.TempVipUserStatusEdit(token, q.ShopID, q.JsonStr, sign)
- rst := a.toWebFunc(rs)
- return rst, nil
- }
- // VipHourEdit 商家会员课时编辑
- func (a Api) VipHourEdit(ctx context.Context, r *pb.StandardRequest) (*pb.StandardReply, error) {
- // 获取token,并验证签名函数
- token, q, sign := a.webToGoVerify(ctx, r)
- rs := service.User{}.VipHourEdit(token, q.ShopID, q.JsonStr, sign)
- rst := a.toWebFunc(rs)
- return rst, nil
- }
- // VipConsumeListQuery 商家会员消费课时查询
- func (a Api) VipConsumeListQuery(ctx context.Context, r *pb.StandardRequest) (*pb.StandardReply, error) {
- // 获取token,并验证签名函数
- token, q, sign := a.webToGoVerify(ctx, r)
- rs := service.User{}.VipConsumeListQuery(token, q.ShopID, q.JsonStr, sign)
- rst := a.toWebFunc(rs)
- return rst, nil
- }
- // VipConsumeDetailQuery 商家会员消费课时详情查询
- func (a Api) VipConsumeDetailQuery(ctx context.Context, r *pb.StandardRequest) (*pb.StandardReply, error) {
- // 获取token,并验证签名函数
- token, q, sign := a.webToGoVerify(ctx, r)
- rs := service.User{}.VipConsumeDetailQuery(token, q.ShopID, q.JsonStr, sign)
- rst := a.toWebFunc(rs)
- return rst, nil
- }
- // VipClassRelationEdit 商家会员对应课程增删
- func (a Api) VipClassRelationEdit(ctx context.Context, r *pb.StandardRequest) (*pb.StandardReply, error) {
- // 获取token,并验证签名函数
- token, q, sign := a.webToGoVerify(ctx, r)
- rs := service.User{}.VipClassRelationEdit(token, q.ShopID, q.JsonStr, sign)
- rst := a.toWebFunc(rs)
- return rst, nil
- }
- // VipHourChgQuery 商家会员消费课时详情查询
- func (a Api) VipHourChgQuery(ctx context.Context, r *pb.StandardRequest) (*pb.StandardReply, error) {
- // 获取token,并验证签名函数
- token, q, sign := a.webToGoVerify(ctx, r)
- rs := service.User{}.VipHourChgQuery(token, q.ShopID, q.JsonStr, sign)
- rst := a.toWebFunc(rs)
- return rst, nil
- }
- // VipUserClassQuery 商家会员课程查询
- func (a Api) VipUserClassQuery(ctx context.Context, r *pb.StandardRequest) (*pb.StandardReply, error) {
- // 获取token,并验证签名函数
- token, q, sign := a.webToGoVerify(ctx, r)
- rs := service.User{}.VipUserClassQuery(token, q.ShopID, q.JsonStr, sign)
- rst := a.toWebFunc(rs)
- return rst, nil
- }
- // GetSimpleQiNiuToken 获取七牛简单Token
- func (a Api) GetSimpleQiNiuToken(ctx context.Context, r *pb.DefaultRequest) (*pb.QiNiuTokenReply, error) {
- token := a.getToken(ctx)
- rs := service.User{}.GetSimpleQiNiuToken(token)
- return rs, nil
- }
- // GetOverlayImgQiNiuToken 获取七牛可覆盖文件Token
- func (a Api) GetOverlayImgQiNiuToken(ctx context.Context, r *pb.GetOverlayImgRequest) (*pb.QiNiuTokenReply, error) {
- token := a.getToken(ctx)
- rs := service.User{}.GetOverlayImgQiNiuToken(token, r.FileName)
- return rs, nil
- }
- // ClassQuery 商家基础课程查询
- func (a Api) ClassQuery(ctx context.Context, r *pb.StandardRequest) (*pb.StandardReply, error) {
- // 获取token,并验证签名函数
- token, q, sign := a.webToGoVerify(ctx, r)
- rs := service.Class{}.ClassQuery(token, q.ShopID, q.JsonStr, sign)
- rst := a.toWebFunc(rs)
- return rst, nil
- }
- // ClassAdd 商家基础课程添加
- func (a Api) ClassAdd(ctx context.Context, r *pb.StandardRequest) (*pb.StandardReply, error) {
- // 获取token,并验证签名函数
- token, q, sign := a.webToGoVerify(ctx, r)
- rs := service.Class{}.ClassAdd(token, q.ShopID, q.JsonStr, sign)
- rst := a.toWebFunc(rs)
- return rst, nil
- }
- // ClassEdit 商家基础课程编辑
- func (a Api) ClassEdit(ctx context.Context, r *pb.StandardRequest) (*pb.StandardReply, error) {
- // 获取token,并验证签名函数
- token, q, sign := a.webToGoVerify(ctx, r)
- rs := service.Class{}.ClassEdit(token, q.ShopID, q.JsonStr, sign)
- rst := a.toWebFunc(rs)
- return rst, nil
- }
- // ClassStatusEdit 商家基础课程状态编辑
- func (a Api) ClassStatusEdit(ctx context.Context, r *pb.StandardRequest) (*pb.StandardReply, error) {
- // 获取token,并验证签名函数
- token, q, sign := a.webToGoVerify(ctx, r)
- rs := service.Class{}.ClassStatusEdit(token, q.ShopID, q.JsonStr, sign)
- rst := a.toWebFunc(rs)
- return rst, nil
- }
- // ClassColorEdit 商家基础课程颜色修改
- func (a Api) ClassColorEdit(ctx context.Context, r *pb.StandardRequest) (*pb.StandardReply, error) {
- // 获取token,并验证签名函数
- token, q, sign := a.webToGoVerify(ctx, r)
- rs := service.Class{}.ClassColorEdit(token, q.ShopID, q.JsonStr, sign)
- rst := a.toWebFunc(rs)
- return rst, nil
- }
- // ClassWxVisibleEdit 商家基础课程微信显示状态修改
- func (a Api) ClassWxVisibleEdit(ctx context.Context, r *pb.StandardRequest) (*pb.StandardReply, error) {
- // 获取token,并验证签名函数
- token, q, sign := a.webToGoVerify(ctx, r)
- rs := service.Class{}.ClassWxVisibleEdit(token, q.ShopID, q.JsonStr, sign)
- rst := a.toWebFunc(rs)
- return rst, nil
- }
- // ClassVipEdit 商家课程会员增删
- func (a Api) ClassVipEdit(ctx context.Context, r *pb.StandardRequest) (*pb.StandardReply, error) {
- // 获取token,并验证签名函数
- token, q, sign := a.webToGoVerify(ctx, r)
- rs := service.Class{}.ClassVipEdit(token, q.ShopID, q.JsonStr, sign)
- rst := a.toWebFunc(rs)
- return rst, nil
- }
- // SttPlanBasicQuery 商家课程表模板总览查询
- func (a Api) SttPlanBasicQuery(ctx context.Context, r *pb.StandardRequest) (*pb.StandardReply, error) {
- // 获取token,并验证签名函数
- token, q, sign := a.webToGoVerify(ctx, r)
- rs := service.Class{}.SttPlanBasicQuery(token, q.ShopID, q.JsonStr, sign)
- rst := a.toWebFunc(rs)
- return rst, nil
- }
- // SttPlanBasicAdd 商家课程表模板总览添加
- func (a Api) SttPlanBasicAdd(ctx context.Context, r *pb.StandardRequest) (*pb.StandardReply, error) {
- // 获取token,并验证签名函数
- token, q, sign := a.webToGoVerify(ctx, r)
- rs := service.Class{}.SttPlanBasicAdd(token, q.ShopID, q.JsonStr, sign)
- rst := a.toWebFunc(rs)
- return rst, nil
- }
- // SttPlanBasicEdit 商家课程表模板总览编辑
- func (a Api) SttPlanBasicEdit(ctx context.Context, r *pb.StandardRequest) (*pb.StandardReply, error) {
- // 获取token,并验证签名函数
- token, q, sign := a.webToGoVerify(ctx, r)
- rs := service.Class{}.SttPlanBasicEdit(token, q.ShopID, q.JsonStr, sign)
- rst := a.toWebFunc(rs)
- return rst, nil
- }
- // SttPlanBasicShopEdit 商家课程表模板总览所属商家修改
- func (a Api) SttPlanBasicShopEdit(ctx context.Context, r *pb.StandardRequest) (*pb.StandardReply, error) {
- // 获取token,并验证签名函数
- token, q, sign := a.webToGoVerify(ctx, r)
- rs := service.Class{}.SttPlanBasicShopEdit(token, q.ShopID, q.JsonStr, sign)
- rst := a.toWebFunc(rs)
- return rst, nil
- }
- // SttPlanBasicStatusEdit 商家课程表模板状态
- func (a Api) SttPlanBasicStatusEdit(ctx context.Context, r *pb.StandardRequest) (*pb.StandardReply, error) {
- // 获取token,并验证签名函数
- token, q, sign := a.webToGoVerify(ctx, r)
- rs := service.Class{}.SttPlanBasicStatusEdit(token, q.ShopID, q.JsonStr, sign)
- rst := a.toWebFunc(rs)
- return rst, nil
- }
- // SttPlanBasicPublish 商家课程表模板发布
- func (a Api) SttPlanBasicPublish(ctx context.Context, r *pb.StandardRequest) (*pb.StandardReply, error) {
- // 获取token,并验证签名函数
- token, q, sign := a.webToGoVerify(ctx, r)
- rs := service.Class{}.SttPlanBasicPublish(token, q.ShopID, q.JsonStr, sign)
- rst := a.toWebFunc(rs)
- return rst, nil
- }
- // SttPlanPreview 商家课程表模板详情预览
- func (a Api) SttPlanPreview(ctx context.Context, r *pb.StandardRequest) (*pb.StandardReply, error) {
- // 获取token,并验证签名函数
- token, q, sign := a.webToGoVerify(ctx, r)
- rs := service.Class{}.SttPlanPreview(token, q.ShopID, q.JsonStr, sign)
- rst := a.toWebFunc(rs)
- return rst, nil
- }
- // SttPlanCopy 商家课程表模板复制
- func (a Api) SttPlanCopy(ctx context.Context, r *pb.StandardRequest) (*pb.StandardReply, error) {
- // 获取token,并验证签名函数
- token, q, sign := a.webToGoVerify(ctx, r)
- rs := service.Class{}.SttPlanCopy(token, q.ShopID, q.JsonStr, sign)
- rst := a.toWebFunc(rs)
- return rst, nil
- }
- // SttPlanDetailQuery 商家课程表模板详情查询
- func (a Api) SttPlanDetailQuery(ctx context.Context, r *pb.StandardRequest) (*pb.StandardReply, error) {
- // 获取token,并验证签名函数
- token, q, sign := a.webToGoVerify(ctx, r)
- rs := service.Class{}.SttPlanDetailQuery(token, q.ShopID, q.JsonStr, sign)
- rst := a.toWebFunc(rs)
- return rst, nil
- }
- // SttPlanDetailBatchSave 商家课程表模板详情批量保存
- func (a Api) SttPlanDetailBatchSave(ctx context.Context, r *pb.StandardRequest) (*pb.StandardReply, error) {
- // 获取token,并验证签名函数
- token, q, sign := a.webToGoVerify(ctx, r)
- rs := service.Class{}.SttPlanDetailBatchSave(token, q.ShopID, q.JsonStr, sign)
- rst := a.toWebFunc(rs)
- return rst, nil
- }
- // STTBasicQuery 商家课程表总览查询
- func (a Api) STTBasicQuery(ctx context.Context, r *pb.StandardRequest) (*pb.StandardReply, error) {
- // 获取token,并验证签名函数
- token, q, sign := a.webToGoVerify(ctx, r)
- rs := service.Class{}.STTBasicQuery(token, q.ShopID, q.JsonStr, sign)
- rst := a.toWebFunc(rs)
- return rst, nil
- }
- // STTBasicAdd 商家课程表总览添加
- func (a Api) STTBasicAdd(ctx context.Context, r *pb.StandardRequest) (*pb.StandardReply, error) {
- // 获取token,并验证签名函数
- token, q, sign := a.webToGoVerify(ctx, r)
- rs := service.Class{}.STTBasicAdd(token, q.ShopID, q.JsonStr, sign)
- rst := a.toWebFunc(rs)
- return rst, nil
- }
- // STTBasicEdit 商家课程表总览编辑
- func (a Api) STTBasicEdit(ctx context.Context, r *pb.StandardRequest) (*pb.StandardReply, error) {
- // 获取token,并验证签名函数
- token, q, sign := a.webToGoVerify(ctx, r)
- rs := service.Class{}.STTBasicEdit(token, q.ShopID, q.JsonStr, sign)
- if !a.checkRs(rs) {
- rst := a.toWebFunc(rs)
- return rst, nil
- }
- rst := a.toWebFunc(rs)
- return rst, nil
- }
- // STTBasicStatusEdit 商家课程表总览状态修改
- func (a Api) STTBasicStatusEdit(ctx context.Context, r *pb.StandardRequest) (*pb.StandardReply, error) {
- // 获取token,并验证签名函数
- token, q, sign := a.webToGoVerify(ctx, r)
- rs := service.Class{}.STTBasicStatusEdit(token, q.ShopID, q.JsonStr, sign)
- rst := a.toWebFunc(rs)
- return rst, nil
- }
- // STTBasicPreview 商家课程表详情预览
- func (a Api) STTBasicPreview(ctx context.Context, r *pb.StandardRequest) (*pb.StandardReply, error) {
- // 获取token,并验证签名函数
- token, q, sign := a.webToGoVerify(ctx, r)
- rs := service.Class{}.STTBasicPreview(token, q.ShopID, q.JsonStr, sign)
- rst := a.toWebFunc(rs)
- return rst, nil
- }
- // STTBasicCopy 商家课程表模板复制
- func (a Api) STTBasicCopy(ctx context.Context, r *pb.StandardRequest) (*pb.StandardReply, error) {
- // 获取token,并验证签名函数
- token, q, sign := a.webToGoVerify(ctx, r)
- rs := service.Class{}.STTBasicCopy(token, q.ShopID, q.JsonStr, sign)
- rst := a.toWebFunc(rs)
- return rst, nil
- }
- // STTBasicOfflineEdit 商家课程表上下线状态修改
- func (a Api) STTBasicOfflineEdit(ctx context.Context, r *pb.StandardRequest) (*pb.StandardReply, error) {
- // 获取token,并验证签名函数
- token, q, sign := a.webToGoVerify(ctx, r)
- rs := service.Class{}.STTBasicOfflineEdit(token, q.ShopID, q.JsonStr, sign)
- rst := a.toWebFunc(rs)
- return rst, nil
- }
- // STTDetailListQuery 商家课程表详情列表查询
- func (a Api) STTDetailListQuery(ctx context.Context, r *pb.StandardRequest) (*pb.StandardReply, error) {
- // 获取token,并验证签名函数
- token, q, sign := a.webToGoVerify(ctx, r)
- rs := service.Class{}.STTDetailListQuery(token, q.ShopID, q.JsonStr, sign)
- rst := a.toWebFunc(rs)
- return rst, nil
- }
- // STTBasicDetailBatchSave 商家课程表详情批量保存
- func (a Api) STTBasicDetailBatchSave(ctx context.Context, r *pb.StandardRequest) (*pb.StandardReply, error) {
- // 获取token,并验证签名函数
- token, q, sign := a.webToGoVerify(ctx, r)
- rs := service.Class{}.STTBasicDetailBatchSave(token, q.ShopID, q.JsonStr, sign)
- rst := a.toWebFunc(rs)
- return rst, nil
- }
- // STTDetailAllowDelCheck 商家课程表详情判断是否可删除
- func (a Api) STTDetailAllowDelCheck(ctx context.Context, r *pb.StandardRequest) (*pb.StandardReply, error) {
- // 获取token,并验证签名函数
- token, q, sign := a.webToGoVerify(ctx, r)
- rs := service.Class{}.STTDetailAllowDelCheck(token, q.ShopID, q.JsonStr, sign)
- rst := a.toWebFunc(rs)
- return rst, nil
- }
- // ----------------------- 商家上下课管理 ---------------------------------------------
- // CourseDetailQuery 课程管理查询
- func (a Api) CourseDetailQuery(ctx context.Context, r *pb.StandardRequest) (*pb.StandardReply, error) {
- // 获取token,并验证签名函数
- token, q, sign := a.webToGoVerify(ctx, r)
- rs := service.Course{}.CourseDetailQuery(token, q.ShopID, q.JsonStr, sign)
- rst := a.toWebFunc(rs)
- return rst, nil
- }
- // ClassListByOrderDate 某日课程表查询
- func (a Api) ClassListByOrderDate(ctx context.Context, r *pb.StandardRequest) (*pb.StandardReply, error) {
- // 获取token,并验证签名函数
- token, q, sign := a.webToGoVerify(ctx, r)
- rs := service.Course{}.ClassListByOrderDate(token, q.ShopID, q.JsonStr, sign)
- rst := a.toWebFunc(rs)
- return rst, nil
- }
- // ClassStartPrepare 上课准备
- func (a Api) ClassStartPrepare(ctx context.Context, r *pb.CourseStandardRequest) (*pb.StandardReply, error) {
- // 获取token,并验证签名函数
- token, q, sign := a.courseToGoVerify(ctx, r)
- rs := service.Course{}.ClassStartPrepare(token, q.ShopID, q.JsonStr, sign)
- if !a.checkRs(rs) {
- rst := a.toWebFunc(rs)
- return rst, nil
- }
- if q.IsHr == 1 {
- hrRs := service.Hr{}.HrClassStartPrepare(token, q.ShopID, q.JsonStr, sign)
- if !a.checkRs(hrRs) {
- rst := a.toWebFunc(hrRs)
- return rst, nil
- }
- }
- if q.IsScore == 1 {
- // todo 调用评分系统接口
- if !a.checkRs(rs) {
- rst := a.toWebFunc(rs)
- return rst, nil
- }
- }
- rst := a.toWebFunc(rs)
- return rst, nil
- }
- // ClassStartPrepareEdit 上课准备修改
- func (a Api) ClassStartPrepareEdit(ctx context.Context, r *pb.CourseStandardRequest) (*pb.StandardReply, error) {
- // 获取token,并验证签名函数
- token, q, sign := a.courseToGoVerify(ctx, r)
- rs := service.Course{}.ClassStartPrepareEdit(token, q.ShopID, q.JsonStr, sign)
- if !a.checkRs(rs) {
- rst := a.toWebFunc(rs)
- return rst, nil
- }
- if q.IsHr == 1 {
- hrRs := service.Hr{}.ClassStartPrepareEdit(token, q.ShopID, q.JsonStr, sign)
- if !a.checkRs(hrRs) {
- rst := a.toWebFunc(rs)
- return rst, nil
- }
- }
- if q.IsScore == 1 {
- // todo 调用评分系统接口
- if !a.checkRs(rs) {
- rst := a.toWebFunc(rs)
- return rst, nil
- }
- }
- rst := a.toWebFunc(rs)
- return rst, nil
- }
- // VipClassDetailQuery 会员上课详情查询
- func (a Api) VipClassDetailQuery(ctx context.Context, r *pb.StandardRequest) (*pb.StandardReply, error) {
- // 获取token,并验证签名函数
- token, q, sign := a.webToGoVerify(ctx, r)
- rs := service.Course{}.VipClassDetailQuery(token, q.ShopID, q.JsonStr, sign)
- rst := a.toWebFunc(rs)
- return rst, nil
- }
- // VipClassDetailAdd 会员上课详情添加-上课未预约
- func (a Api) VipClassDetailAdd(ctx context.Context, r *pb.CourseStandardRequest) (*pb.StandardReply, error) {
- // 获取token,并验证签名函数
- token, q, sign := a.courseToGoVerify(ctx, r)
- rs := service.Course{}.VipClassDetailAdd(token, q.ShopID, q.JsonStr, sign)
- if !a.checkRs(rs) {
- rst := a.toWebFunc(rs)
- return rst, nil
- }
- if q.IsHr == 1 {
- hrRs := service.Hr{}.HrClassDetailAdd(token, q.ShopID, q.JsonStr, sign)
- if !a.checkRs(hrRs) {
- rst := a.toWebFunc(hrRs)
- return rst, nil
- }
- }
- if q.IsScore == 1 {
- // todo 调用评分系统接口
- }
- rst := a.toWebFunc(rs)
- return rst, nil
- }
- // VipClassDetailDel 会员上课详情删除
- func (a Api) VipClassDetailDel(ctx context.Context, r *pb.CourseStandardRequest) (*pb.StandardReply, error) {
- // 获取token,并验证签名函数
- token, q, sign := a.courseToGoVerify(ctx, r)
- // 删除应该是先删除心率跟评分库,再去删除基础库数据
- if q.IsHr == 1 {
- hrRs := service.Hr{}.HrClassDetailDel(token, q.ShopID, q.JsonStr, sign)
- if !a.checkRs(hrRs) {
- rst := a.toWebFunc(hrRs)
- return rst, nil
- }
- }
- if q.IsScore == 1 {
- // todo 调用评分系统接口
- }
- rs := service.Course{}.VipClassDetailDel(token, q.ShopID, q.JsonStr, sign)
- if !a.checkRs(rs) {
- rst := a.toWebFunc(rs)
- return rst, nil
- }
- rst := a.toWebFunc(rs)
- return rst, nil
- }
- // TmpClassDetailAdd 临时会员上课详情添加
- func (a Api) TmpClassDetailAdd(ctx context.Context, r *pb.CourseStandardRequest) (*pb.StandardReply, error) {
- // 获取token,并验证签名函数
- token, q, sign := a.courseToGoVerify(ctx, r)
- rs := service.Course{}.TmpClassDetailAdd(token, q.ShopID, q.JsonStr, sign)
- if !a.checkRs(rs) {
- rst := a.toWebFunc(rs)
- return rst, nil
- }
- if q.IsHr == 1 {
- hrRs := service.Hr{}.HrClassDetailDel(token, q.ShopID, q.JsonStr, sign)
- if !a.checkRs(hrRs) {
- rst := a.toWebFunc(hrRs)
- return rst, nil
- }
- }
- if q.IsScore == 1 {
- // todo 调用评分系统接口
- }
- rst := a.toWebFunc(rs)
- return rst, nil
- }
- // TmpClassDetailDel 临时会员上课详情删除
- func (a Api) TmpClassDetailDel(ctx context.Context, r *pb.CourseStandardRequest) (*pb.StandardReply, error) {
- // 获取token,并验证签名函数
- token, q, sign := a.courseToGoVerify(ctx, r)
- // 删除应该是先删除心率跟评分库,再去删除基础库数据
- if q.IsHr == 1 {
- hrRs := service.Hr{}.HrClassDetailDel(token, q.ShopID, q.JsonStr, sign)
- if !a.checkRs(hrRs) {
- rst := a.toWebFunc(hrRs)
- return rst, nil
- }
- }
- if q.IsScore == 1 {
- // todo 调用评分系统接口
- }
- rs := service.Course{}.TmpClassDetailDel(token, q.ShopID, q.JsonStr, sign)
- if !a.checkRs(rs) {
- rst := a.toWebFunc(rs)
- return rst, nil
- }
- rst := a.toWebFunc(rs)
- return rst, nil
- }
- // VipClassDetailStatueEdit 会员上课详情状态修改
- func (a Api) VipClassDetailStatueEdit(ctx context.Context, r *pb.CourseStandardRequest) (*pb.StandardReply, error) {
- // 获取token,并验证签名函数
- token, q, sign := a.courseToGoVerify(ctx, r)
- rs := service.Course{}.VipClassDetailStatueEdit(token, q.ShopID, q.JsonStr, sign)
- if !a.checkRs(rs) {
- rst := a.toWebFunc(rs)
- return rst, nil
- }
- if q.IsHr == 1 {
- hrRs := service.Hr{}.HrClassDetailStatusEdit(token, q.ShopID, q.JsonStr, sign)
- if !a.checkRs(hrRs) {
- rst := a.toWebFunc(hrRs)
- return rst, nil
- }
- }
- if q.IsScore == 1 {
- // todo 调用评分系统接口
- }
- rst := a.toWebFunc(rs)
- return rst, nil
- }
- // ClassStartConfirm 确认上课
- func (a Api) ClassStartConfirm(ctx context.Context, r *pb.CourseStandardRequest) (*pb.StandardReply, error) {
- // 获取token,并验证签名函数
- token, q, sign := a.courseToGoVerify(ctx, r)
- rs := service.Course{}.ClassStartConfirm(token, q.ShopID, q.JsonStr, sign)
- if !a.checkRs(rs) {
- rst := a.toWebFunc(rs)
- return rst, nil
- }
- if q.IsScore == 1 {
- // todo 调用评分系统接口
- }
- if q.IsHr == 1 {
- hrRs := service.Hr{}.HrClassStartConfirm(token, q.ShopID, q.JsonStr, sign)
- if !a.checkRs(hrRs) {
- rst := a.toWebFunc(hrRs)
- return rst, nil
- }
- redisRs := service.HrRedis{}.ClassStartR1AndOnClassByUUStdID(token, q.ShopID, q.UUStdID)
- if !a.checkRs(redisRs) {
- rst := a.toWebFunc(redisRs)
- return rst, nil
- }
- }
- rst := a.toWebFunc(rs)
- return rst, nil
- }
- // ClassOverConfirm 确认下课
- func (a Api) ClassOverConfirm(ctx context.Context, r *pb.StandardRequest) (*pb.StandardReply, error) {
- // 获取token,并验证签名函数
- token, q, sign := a.webToGoVerify(ctx, r)
- rs := service.Course{}.ClassOverConfirm(token, q.ShopID, q.JsonStr, sign)
- rst := a.toWebFunc(rs)
- return rst, nil
- }
- // ClassGiveUpConfirm 关闭课程
- func (a Api) ClassGiveUpConfirm(ctx context.Context, r *pb.CourseStandardRequest) (*pb.StandardReply, error) {
- // 获取token,并验证签名函数
- token, q, sign := a.courseToGoVerify(ctx, r)
- rs := service.Course{}.ClassGiveUpConfirm(token, q.ShopID, q.JsonStr, sign)
- if !a.checkRs(rs) {
- rst := a.toWebFunc(rs)
- return rst, nil
- }
- if q.IsHr == 1 {
- hrRs := service.Hr{}.HrClassGiveUpConfirm(token, q.ShopID, q.JsonStr, sign)
- if !a.checkRs(hrRs) {
- rst := a.toWebFunc(hrRs)
- return rst, nil
- }
- }
- if q.IsScore == 1 {
- // todo 调用评分系统接口
- }
- rst := a.toWebFunc(rs)
- return rst, nil
- }
- // AfterClassAddClassDetail 关闭课程
- func (a Api) AfterClassAddClassDetail(ctx context.Context, r *pb.CourseStandardRequest) (*pb.StandardReply, error) {
- // 获取token,并验证签名函数
- token, q, sign := a.courseToGoVerify(ctx, r)
- var rs string
- // 因为是上课后追加的人,已经在基础库中添加,所以只需要在心率与评分中加入
- //rs := service.Course{}.ClassGiveUpConfirm(token, q.ShopID, q.JsonStr, sign)
- if q.IsHr == 1 {
- rs = service.Hr{}.AfterClassAddClassDetail(token, q.ShopID, q.JsonStr, sign)
- if !a.checkRs(rs) {
- rst := a.toWebFunc(rs)
- return rst, nil
- }
- }
- if q.IsScore == 1 {
- // todo 调用评分系统接口
- }
- rst := a.toWebFunc(rs)
- return rst, nil
- }
- // ----------------------- 商家预约管理 ---------------------------------------------
- // OrderListQuery 预约记录查询
- func (a Api) OrderListQuery(ctx context.Context, r *pb.StandardRequest) (*pb.StandardReply, error) {
- // 获取token,并验证签名函数
- token, q, sign := a.webToGoVerify(ctx, r)
- rs := service.Order{}.OrderListQuery(token, q.ShopID, q.JsonStr, sign)
- rst := a.toWebFunc(rs)
- return rst, nil
- }
- // OrderAddByManager 管理员预约添加
- func (a Api) OrderAddByManager(ctx context.Context, r *pb.StandardRequest) (*pb.StandardReply, error) {
- // 获取token,并验证签名函数
- token, q, sign := a.webToGoVerify(ctx, r)
- rs := service.Order{}.OrderAddByManager(token, q.ShopID, q.JsonStr, sign)
- rst := a.toWebFunc(rs)
- return rst, nil
- }
- // OrderCancelByManager 管理员预约取消
- func (a Api) OrderCancelByManager(ctx context.Context, r *pb.StandardRequest) (*pb.StandardReply, error) {
- // 获取token,并验证签名函数
- token, q, sign := a.webToGoVerify(ctx, r)
- rs := service.Order{}.OrderCancelByManager(token, q.ShopID, q.JsonStr, sign)
- rst := a.toWebFunc(rs)
- return rst, nil
- }
- // OrderStatistics 商家预约统计
- func (a Api) OrderStatistics(ctx context.Context, r *pb.StandardRequest) (*pb.StandardReply, error) {
- // 获取token,并验证签名函数
- token, q, sign := a.webToGoVerify(ctx, r)
- rs := service.Order{}.OrderStatistics(token, q.ShopID, q.JsonStr, sign)
- rst := a.toWebFunc(rs)
- return rst, nil
- }
- // ClassOrderQuery 可预约课程预约列表查询
- func (a Api) ClassOrderQuery(ctx context.Context, r *pb.StandardRequest) (*pb.StandardReply, error) {
- // 获取token,并验证签名函数
- token, q, sign := a.webToGoVerify(ctx, r)
- rs := service.Order{}.ClassOrderQuery(token, q.ShopID, q.JsonStr, sign)
- rst := a.toWebFunc(rs)
- return rst, nil
- }
- // VipUserOrderQuery 会员预约列表查询
- func (a Api) VipUserOrderQuery(ctx context.Context, r *pb.StandardRequest) (*pb.StandardReply, error) {
- // 获取token,并验证签名函数
- token, q, sign := a.webToGoVerify(ctx, r)
- rs := service.Order{}.VipUserOrderQuery(token, q.ShopID, q.JsonStr, sign)
- rst := a.toWebFunc(rs)
- return rst, nil
- }
- // UserOrderQueryByStd 查询课程预约用户列表
- func (a Api) UserOrderQueryByStd(ctx context.Context, r *pb.StandardRequest) (*pb.StandardReply, error) {
- // 获取token,并验证签名函数
- token, q, sign := a.webToGoVerify(ctx, r)
- rs := service.Order{}.UserOrderQueryByStd(token, q.ShopID, q.JsonStr, sign)
- rst := a.toWebFunc(rs)
- return rst, nil
- }
- // ----------------------- 商家心率管理 ---------------------------------------------
- // HrSensorsPublicQuery 公共心率带查询
- func (a Api) HrSensorsPublicQuery(ctx context.Context, r *pb.StandardRequest) (*pb.StandardReply, error) {
- // 获取token,并验证签名函数
- token, q, sign := a.webToGoVerify(ctx, r)
- rs := service.Hr{}.HrSensorsPublicQuery(token, q.ShopID, q.JsonStr, sign)
- rst := a.toWebFunc(rs)
- return rst, nil
- }
- // HrSensorsPvtQuery 私有心率带查询
- func (a Api) HrSensorsPvtQuery(ctx context.Context, r *pb.StandardRequest) (*pb.StandardReply, error) {
- // 获取token,并验证签名函数
- token, q, sign := a.webToGoVerify(ctx, r)
- rs := service.Hr{}.HrSensorsPvtQuery(token, q.ShopID, q.JsonStr, sign)
- rst := a.toWebFunc(rs)
- return rst, nil
- }
- // AddHrSensors 公共心率带添加
- func (a Api) AddHrSensors(ctx context.Context, r *pb.StandardRequest) (*pb.StandardReply, error) {
- // 获取token,并验证签名函数
- token, q, sign := a.webToGoVerify(ctx, r)
- rs := service.Hr{}.AddHrSensors(token, q.ShopID, q.JsonStr, sign)
- rst := a.toWebFunc(rs)
- return rst, nil
- }
- // AddPvtHrSensors 私有心率带添加
- func (a Api) AddPvtHrSensors(ctx context.Context, r *pb.StandardRequest) (*pb.StandardReply, error) {
- // 获取token,并验证签名函数
- token, q, sign := a.webToGoVerify(ctx, r)
- rs := service.Hr{}.AddPvtHrSensors(token, q.ShopID, q.JsonStr, sign)
- rst := a.toWebFunc(rs)
- return rst, nil
- }
- // EditHrSensors 心率带编辑
- func (a Api) EditHrSensors(ctx context.Context, r *pb.StandardRequest) (*pb.StandardReply, error) {
- // 获取token,并验证签名函数
- token, q, sign := a.webToGoVerify(ctx, r)
- rs := service.Hr{}.EditHrSensors(token, q.ShopID, q.JsonStr, sign)
- rst := a.toWebFunc(rs)
- return rst, nil
- }
- // HrSensorsDel 心率带删除
- func (a Api) HrSensorsDel(ctx context.Context, r *pb.StandardRequest) (*pb.StandardReply, error) {
- // 获取token,并验证签名函数
- token, q, sign := a.webToGoVerify(ctx, r)
- rs := service.Hr{}.HrSensorsDel(token, q.ShopID, q.JsonStr, sign)
- rst := a.toWebFunc(rs)
- return rst, nil
- }
- // PKGroupChg 修改PK分队
- func (a Api) PKGroupChg(ctx context.Context, r *pb.StandardRequest) (*pb.StandardReply, error) {
- // 获取token,并验证签名函数
- token, q, sign := a.webToGoVerify(ctx, r)
- rs := service.Hr{}.PKGroupChg(token, q.ShopID, q.JsonStr, sign)
- rst := a.toWebFunc(rs)
- return rst, nil
- }
- // BindHrSensor 绑定心率带
- func (a Api) BindHrSensor(ctx context.Context, r *pb.StandardRequest) (*pb.StandardReply, error) {
- // 获取token,并验证签名函数
- token, q, sign := a.webToGoVerify(ctx, r)
- rs := service.Hr{}.BindHrSensor(token, q.ShopID, q.JsonStr, sign)
- rst := a.toWebFunc(rs)
- return rst, nil
- }
- // UnBindHrSensor 解绑心率带
- func (a Api) UnBindHrSensor(ctx context.Context, r *pb.StandardRequest) (*pb.StandardReply, error) {
- // 获取token,并验证签名函数
- token, q, sign := a.webToGoVerify(ctx, r)
- rs := service.Hr{}.UnBindHrSensor(token, q.ShopID, q.JsonStr, sign)
- rst := a.toWebFunc(rs)
- return rst, nil
- }
- // ----------------------- 评分管理 ---------------------------------------------
- // ----------------------- 微信管理 ---------------------------------------------
- // GenVerifyImageByWinXin 微信登陆获取图片验证码
- func (Api) GenVerifyImageByWinXin(ctx context.Context, r *pb.GenVerifyImageRequest) (*pb.GenVerifyImageReply, error) {
- //height := int(r.Height)
- //width := int(r.Width)
- id, pic := service.VerifyCode{}.GenImage(int(r.Height), int(r.Width))
- return &pb.GenVerifyImageReply{
- CodeId: id,
- ImageBase64: pic,
- }, nil
- }
- // GenPhoneVerifyCodeByWeiXin 微信登陆获取短信验证码
- func (a Api) GenPhoneVerifyCodeByWeiXin(ctx context.Context, r *pb.GenPhoneVerifyCodeRequestWX) (*pb.StandardReply, error) {
- ip := a.getRemoteIp(ctx)
- rs := service.VerifyCode{}.GetPhoneVFCode(
- r.SId,
- r.Account, ip, global.TemplateCode, r.CodeId, r.ImgCode, r.VerifyType, time.Duration(global.SmsExpireNano))
- rst := a.toWebFunc(rs)
- return rst, nil
- }
- //// WeiXinSignIn 微信登陆
- //func (a Api) WeiXinSignIn(ctx context.Context, r *pb.WeiXinSignInRequest) (*pb.SignInReply, error) {
- //
- //
- // rs := service.Wx{}.WeiXinSignIn(token, q.ShopID, q.JsonStr, sign)
- //
- // return &pb.SignInReply{Token: rs}, nil
- //}
|