123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052 |
- <?php
- namespace app\sys\controller;
- use app\model\Company;
- use app\model\CompanyBossOpen;
- use app\logics\Unionaccount;
- use think\facade\View;
- use OSS\Core\OssException;
- use OSS\OssClient;
- use app\model\Employee;
- class Broad
- {
- /**
- * 面板
- */
- public function index()
- {
- $condition = [
- ['root_id' ,'=', request()->employee->root_id],
- ['end_at', '>', date('Y-m-d'). ' 00:00:00']
- ];
- $companybossopened = CompanyBossOpen::where($condition)->find();
- $state = $companybossopened?1:0;
- if($state == 0){
- $way = 'free';
- if($way == 'free'){
- $root_id = request()->employee->root_id;
- View::assign('root_id', $root_id);
- View::assign('freetime', 30);
- return View::fetch('openning_free');
- }else{
- return View::fetch('openning');
- }
- }else{
- // 获取卡片数据
- $this->card();
- // 获取线型图数据
- $this->line();
- //$notice_status = model('company')->where('cmid', session('company', '', 'live'))->value('notice_status');
- View::assign('notice_status', 1);
- $content_status = 0;
- //$content = model('config')->where('field', 'companynotice')->value('content');
- //if (!empty($content)) {
- // $state = json_decode($content, true);
- // $content_status = $state['status'];
- //}
- View::assign('content_status', 0);
- return View::fetch('index');
- }
- }
- /**
- * 获取卡片数据
- */
- private function card()
- {
- // 打赏数据
- //$gift = model('giftLog')
- // ->field('IFNULL(sum(money),0) money, count(id) num')
- // ->where(['cmid' => session('company', '', 'live'), 'status' => 1])
- // ->find();
- $gift = ['money' =>10, 'num'=> 10];
- View::assign('gift', $gift);
- // 收订数据
- //$order = model('order')
- // ->field('IFNULL(sum(money),0) money, count(id) num')
- // ->where(['cmid' => session('company', '', 'live'), 'status' => 1])
- // ->find();
- $order = ['money' =>10, 'num'=> 10];
- View::assign('order', $order);
- // 裂变余额与裂变次数
- //$money = model('fission')->where('cmid', session('company', '', 'live'))->value('money');
- //$shareNum = model('shareLog')->where(['cmid' => session('company', '', 'live')])->count();
- $money = 1000;
- $shareNum = 200;
- View::assign('money', $money);
- View::assign('shareNum', $shareNum);
- // 账户到期时间及天数
- //$end = model('company')->where('cmid', session('company', '', 'live'))->value('end_date');
- //$day = floor((strtotime($end) - time() + 86400) / 86400);
- $end = '2023-12-31';
- $day = 365;
- View::assign('date', $end);
- View::assign('day', $day);
- // 账户余额获取
- //$yue = model('fission')->where('cmid', session('company', '', 'live'))->value('yue');
- $yue = 120000;
- View::assign('yue', $yue);
- }
- /**
- * 线型图数据
- */
- private function line()
- {
- // 设置日期(月)
- $thisMonth = date('n');
- $m1 = $m2 = [];
- $m = 1;
- while ($m <= 12) {
- $ms = $m;
- $m > $thisMonth ? $m2[] = $ms : $m1[] = $ms;
- $m++;
- }
- $month = array_merge($m2, $m1);
- // 年获取
- // 1)这个月的最后一天
- $lastDay = date('Y-m-d 23:59:59', strtotime('last day of this month'));
- $lastTime = strtotime($lastDay);
- // 2)上一年下个月的第一天
- $firstDay = date('Y-m-d 00:00:00', strtotime('first day of +1 month -1 year'));
- $firstTime = strtotime($firstDay);
- // x轴数据获取
- // 1)分享量
- //$share = model('shareLog')
- // ->where(['cmid' => session('company', '', 'live'), 'addtime' => ['between', [$firstTime, $lastTime]]])
- // ->group('m')
- // ->column("FROM_UNIXTIME(addtime,'%c') m, count(id) num");
- // 2)访问量
- //$login = WsLoginStatics::where(['cmid' => session('company', '', 'live'), 'first_login_time' => ['between', [$firstDay, $lastDay]]])
- // ->group('m')
- // ->column("DATE_FORMAT(first_login_time,'%c') m, count(id) num");
- // 3)订单量
- //$order = model('order')
- // ->where(['cmid' => session('company', '', 'live'), 'addtime' => ['between', [$firstDay, $lastDay]], 'status' => 1])
- // ->group('m')
- // ->column("DATE_FORMAT(addtime,'%c') m, count(id) num");
- // 数据整理
- //$shareArr = $loginArr = $orderArr = [];
- //foreach ($month as &$m) {
- // $shareArr[] = isset($share[$m]) ? $share[$m] : 0;
- // //$loginArr[] = isset($login[$m]) ? $login[$m] : 0;
- // $orderArr[] = isset($order[$m]) ? $order[$m] : 0;
- // $m .= '月';
- //}
- View::assign('shareArr', json_encode([]));
- View::assign('loginArr', json_encode([]));
- View::assign('orderArr', json_encode([]));
- View::assign('month', json_encode([]));
- }
- //////////////////////
- public function boss_openning($root_id){
- $company = Company::where(['root_id'=>$root_id])->find();
- if(!$company){
- return false;
- }
- $freetime = 30;
- $companybossopen = CompanyBossOpen::where(['root_id'=>$root_id])->find();
- if($companybossopen && $companybossopen->end_at < date('Y-m-d'). ' 00:00:00'){
- $updatedata = [
- 'end_at' => date('Y-m-d',strtotime('+'.$freetime.' day')),
- ];
- $companybossopen->save($updatedata);
- }else{
- //$productType = 'boss_live';
- $way = 'free';
- ///记录免费订单
- $insertdata = [
- 'company_name' => $company->company_name,
- 'company_id' => $company->id,
- 'root_id' => $root_id,
- 'unionid' => unionidgen(hanzi2pinyin($company->company_name),16),
- 'username' => hanzi2pinyin($company->company_name),
- 'way' => $way,
- 'start_at' => date('Y-m-d',time()),
- 'end_at' => date('Y-m-d',strtotime('+'.$freetime.' day')),
- 'remark' => ''
- ];
- (new CompanyBossOpen())->insert($insertdata);
- }
- //同步分平台账号
- $datastr = Unionaccount::syncaccount($company->id);
- $data = json_decode($datastr,true);
- if($data['code'] == 0 || $data['code'] == 2){
- return json(['code' => 0, 'msg' =>'成功开通Boss直播'.$freetime.'天免费期。']);
- }else{
- return json(['code' => 2, 'msg' =>$data['msg']]);
- }
- }
- ////////////////
- private function getcmucode(){
- $request = request();
- $root_id = $request->employee->root_id;
- $companybossopen = CompanyBossOpen::where(['root_id'=>$root_id])->find();
- $cmunionid = $companybossopen->unionid;
- return $cmunionid;
- }
- public function build(){
- $request = request();
- if (!$request->isAjax()) {
- return View::fetch();
- }
- $page = 1;
- if($request->param('page')){
- $page = $request->param('page');
- }
- // 获取分页相关参数
- $url = 'https://'.config('app.bosslive_domain').'/saasapi/course/index?page='.$page.'&limit=10';
- if($request->param('title')){
- $title = $request->param('title');
- $url = 'https://'.config('app.bosslive_domain').'/saasapi/course/index?page='.$page.'&limit=10&title='.$title;
- }
- $cmunionid = $this->getcmucode();
- $data = curlparam($url,$cmunionid);
- // 返回数据
- return json_decode($data);
- }
- public function goods(){
- $request = request();
- if (!$request->isAjax()) {
- return View::fetch();
- }
- $page = 1;
- if($request->param('page')){
- $page = $request->param('page');
- }
- // 获取分页相关参数
- $url = 'https://'.config('app.bosslive_domain').'/saasapi/goods/index?page='.$page.'&limit=10';
- $cmunionid = $this->getcmucode();
- $data = curlparam($url,$cmunionid);
- // 返回数据
- return json_decode($data);
- }
- public function goods_add(){
- $request = request();
- if (!$request->isAjax()) {
- return View::fetch();
- }
- $picture = '';
- $rs = $this->ossUploadBosslive('picture', ['jpg', 'png', 'bmp', 'jpeg', 'JPG', 'PNG', 'BMP', 'JPEG']);
- if ($rs['code'] === 0) {
- if (!empty($rs['data']['picture'])) {
- $picture = $rs['data']['picture'];
- }
- }
- $title = $request->param('title');
- $shop_price = $request->param('shop_price');
- $live_price = $request->param('live_price');
- $price = $request->param('price');
- $stock = $request->param('stock');
- $describe = $request->param('describe');
- $details = $request->param('details');
- // 获取分页相关参数
- $url = 'https://'.config('app.bosslive_domain').'/saasapi/goods/add?';
- $url .= 'title='.$title;
- $url .= '&shop_price='.$shop_price;
- $url .= '&live_price='.$live_price;
- $url .= '&price='.$price;
- $url .= '&stock='.$stock;
- $url .= '&picture='.$picture;
- $url .= '&describe='.$describe;
- $url .= '&details='.$details;
- $cmunionid = $this->getcmucode();
- $data = curlparam($url,$cmunionid);
- // 返回数据
- return json_decode($data);
- }
- public function course_setting(){
- $request = request();
- if (!$request->isAjax()) {
- $url = 'https://'.config('app.bosslive_domain').'/saasapi/course/setting';
- $cmunionid = $this->getcmucode();
- $data = curlparam($url,$cmunionid);
- // 返回数据
- $dataraw = json_decode($data, true);
- View::assign('company', $dataraw['data']['company']);
- View::assign('fission', $dataraw['data']['fission']);
- View::assign('teacherNum', $dataraw['data']['teacherNum']);
- return View::fetch();
- }
- }
- public function course_wxqrcode(){
- $request = request();
- if (!$request->isAjax()) {
- $url = 'https://'.config('app.bosslive_domain').'/saasapi/course/wxqrcode_cm_data';
- $cmunionid = $this->getcmucode();
- $data = curlparam($url,$cmunionid);
- // 返回数据
- $dataraw = json_decode($data, true);
- View::assign('company', $dataraw['company']);
- return View::fetch();
- }
- $official_account_qrcode = '';
- $rs = $this->ossUploadBosslive('official_account_qrcode', ['jpg', 'png', 'bmp', 'jpeg', 'JPG', 'PNG', 'BMP', 'JPEG']);
- if ($rs['code'] === 0) {
- if (!empty($rs['data']['official_account_qrcode'])) {
- $official_account_qrcode = $rs['data']['official_account_qrcode'];
- }
- }
- $subscribe = $request->param('subscribe');
- $oa_qrcode_url = $official_account_qrcode;
- $url = 'https://'.config('app.bosslive_domain').'/saasapi/course/wxqrcode?subscribe='.$subscribe.'&official_account_qrcode='.$oa_qrcode_url;
- $cmunionid = $this->getcmucode();
- $data = curlparam($url,$cmunionid);
- // 返回数据
- return json_decode($data);
- }
- public function course_slogan(){
- $request = request();
- if (!$request->isAjax()) {
- $url = 'https://'.config('app.bosslive_domain').'/saasapi/course/slogan_company';
- $cmunionid = $this->getcmucode();
- $data = curlparam($url,$cmunionid);
- // 返回数据
- $dataraw = json_decode($data, true);
- View::assign('company', $dataraw['company']);
- return View::fetch();
- }
- $slogan_state = $request->param('slogan_state');
- $slogan = $request->param('slogan');
- $url = 'https://'.config('app.bosslive_domain').'/saasapi/course/slogan?slogan_state='.$slogan_state.'&slogan='.$slogan;
- $cmunionid = $this->getcmucode();
- $data = curlparam($url,$cmunionid);
- // 返回数据
- return json_decode($data);
- }
- public function course_apilinkpushQr(){
- $request = request();
- $cid = $request->param('cid');
- $url = 'https://'.config('app.bosslive_domain').'/saasapi/course/apilinkpushQr?cid='.$cid;
- $cmunionid = $this->getcmucode();
- $data = curlparam($url,$cmunionid);
- //$url = json_decode($data,true);
- // 返回数据
- return $data;
- }
- public function keyword_index(){
- $request = request();
- if (!$request->isAjax()) {
- return View::fetch();
- }
- $page = 1;
- if($request->param('page')){
- $page = $request->param('page');
- }
- // 获取分页相关参数
- $url = 'https://'.config('app.bosslive_domain').'/saasapi/keyword/index?page='.$page.'&limit=10';
- if($request->param('name')){
- $url .= '&name='.$request->param('name');
- }
- $cmunionid = $this->getcmucode();
- $data = curlparam($url,$cmunionid);
- // 返回数据
- return json_decode($data);
- }
- public function keyword_add(){
- $request = request();
- if (!$request->isAjax()) {
- return View::fetch();
- }
- $value = $request->param('value');
- // 获取分页相关参数
- $url = 'https://'.config('app.bosslive_domain').'/saasapi/keyword/add?value='.$value;
- if($request->param('replace')){
- $url .= '&replace='.$request->param('replace');
- }
- $cmunionid = $this->getcmucode();
- $data = curlparam($url,$cmunionid);
- // 返回数据
- return json_decode($data);
- }
- public function keyword_edit(){
- $request = request();
- $id = $request->param('id');
- if (!$request->isAjax()) {
- $url = 'https://'.config('app.bosslive_domain').'/saasapi/keyword/edit_data?id='.$id;
- $cmunionid = $this->getcmucode();
- $data = curlparam($url,$cmunionid);
- $dataraw = json_decode($data, true);
- View::assign('data', $dataraw['data']);
- return View::fetch();
- }
- $value = $request->param('value');
- // 获取分页相关参数
- $url = 'https://'.config('app.bosslive_domain').'/saasapi/keyword/edit?id='.$id.'&value='.$value;
- $cmunionid = $this->getcmucode();
- $data = curlparam($url,$cmunionid);
- // 返回数据
- return json_decode($data);
- }
- public function keyword_del(){
- $request = request();
- $id = $request->param('id');
- // 获取分页相关参数
- $url = 'https://'.config('app.bosslive_domain').'/saasapi/keyword/del?id='.$id;
- $cmunionid = $this->getcmucode();
- $data = curlparam($url,$cmunionid);
- // 返回数据
- return $data;
- }
- public function present_index(){
- $request = request();
- if (!$request->isAjax()) {
- $url = 'https://'.config('app.bosslive_domain').'/saasapi/present/index';
- $cmunionid = $this->getcmucode();
- $data = curlparam($url,$cmunionid);
- // 返回数据
- $dataraw = json_decode($data, true);
- View::assign('data', $dataraw['data']);
- View::assign('show', $dataraw['show']);
- return View::fetch();
- }
- }
- public function present_state(){
- $request = request();
- $state = $request->param('state');
- // 获取分页相关参数
- $url = 'https://'.config('app.bosslive_domain').'/saasapi/present/state?state='.$state;
- $cmunionid = $this->getcmucode();
- $data = curlparam($url,$cmunionid);
- // 返回数据
- return $data;
- }
- public function present_show(){
- $request = request();
- $id = $request->param('id');
- $state = $request->param('state');
- // 获取分页相关参数
- $url = 'https://'.config('app.bosslive_domain').'/saasapi/present/show?state='.$state.'&id='.$id;
- $cmunionid = $this->getcmucode();
- $data = curlparam($url,$cmunionid);
- // 返回数据
- return $data;
- }
- public function present_save(){
- $request = request();
- $name = $request->param('name');
- $price = $request->param('price');
- $num = $request->param('num');
- $show = $request->param('show');
- // 获取分页相关参数
- $url = 'https://'.config('app.bosslive_domain').'/saasapi/present/save?name='.$name;
- $url .= '&price='.$price;
- $url .= '&num='.$num;
- $url .= '&show='.$show;
- $cmunionid = $this->getcmucode();
- $data = curlparam($url,$cmunionid);
- // 返回数据
- return $data;
- }
- public function present_delete(){
- $request = request();
- $id = $request->param('id');
- // 获取分页相关参数
- $url = 'https://'.config('app.bosslive_domain').'/saasapi/present/delete?id='.$id;
- $cmunionid = $this->getcmucode();
- $data = curlparam($url,$cmunionid);
- // 返回数据
- return $data;
- }
- public function teacher_index(){
- $request = request();
- if (!$request->isAjax()) {
- return View::fetch();
- }
- $page = 1;
- if($request->param('page')){
- $page = $request->param('page');
- }
- // 获取分页相关参数
- $url = 'https://'.config('app.bosslive_domain').'/saasapi/teacher/index?page='.$page.'&limit=10';
- if($request->param('name') && !empty($request->param('name'))){
- $url .= '&name='.$request->param('name');
- }
- $cmunionid = $this->getcmucode();
- $data = curlparam($url,$cmunionid);
- // 返回数据
- return json_decode($data);
- }
- public function teacher_add(){
- $request = request();
- if (!$request->isAjax()) {
- return View::fetch();
- }
- $name = $request->param('name');
- $phone = $request->param('phone');
- $vx = $request->param('vx');
- //$headimg = $request->param('headimg');
- $desc = $request->param('desc');
- $headimg = '';
- $rs = $this->ossUploadBosslive('headimg', ['jpg', 'png', 'bmp', 'jpeg', 'JPG', 'PNG', 'BMP', 'JPEG']);
- if ($rs['code'] === 0) {
- if (!empty($rs['data']['headimg'])) {
- $headimg = $rs['data']['headimg'];
- }
- }
- // 获取分页相关参数
- $url = 'https://'.config('app.bosslive_domain').'/saasapi/teacher/add?';
- $url .= 'name='.$name;
- $url .= '&phone='.$phone;
- $url .= '&vx='.$vx;
- $url .= '&headimg='.$headimg;
- $url .= '&desc='.$desc;
- $cmunionid = $this->getcmucode();
- $data = curlparam($url,$cmunionid);
- // 返回数据
- return $data;
- }
- public function teacher_edit(){
- $request = request();
- $id = $request->param('id');
- if (!$request->isAjax()) {
- $url = 'https://'.config('app.bosslive_domain').'/saasapi/teacher/teacher_train?id='.$id;
- $cmunionid = $this->getcmucode();
- $data = curlparam($url,$cmunionid);
- // 返回数据
- $dataraw = json_decode($data, true);
- View::assign('data', $dataraw['data']);
- return View::fetch();
- }
- $name = $request->param('name');
- $desc = $request->param('desc');
- $vx = $request->param('vx');
- $phone = $request->param('phone');
- // 获取分页相关参数
- $url = 'https://'.config('app.bosslive_domain').'/saasapi/teacher/edit?id='.$id.'&name='.$name;
- $url .= '&desc='.$desc;
- $url .= '&vx='.$vx;
- $url .= '&phone='.$phone;
- $cmunionid = $this->getcmucode();
- $data = curlparam($url,$cmunionid);
- // 返回数据
- return $data;
- }
- public function teacher_del(){
- $request = request();
- $id = $request->param('id');
- // 获取分页相关参数
- $url = 'https://'.config('app.bosslive_domain').'/saasapi/teacher/del?id='.$id;
- $cmunionid = $this->getcmucode();
- $data = curlparam($url,$cmunionid);
- // 返回数据
- return $data;
- }
- public function white_list_index(){
- $request = request();
- if (!$request->isAjax()) {
- return View::fetch();
- }
- $page = 1;
- if($request->param('page')){
- $page = $request->param('page');
- }
- // 获取分页相关参数
- $url = 'https://'.config('app.bosslive_domain').'/saasapi/white_list/index?page='.$page.'&limit=10';
- $cmunionid = $this->getcmucode();
- $data = curlparam($url,$cmunionid);
- // 返回数据
- return json_decode($data);
- }
- public function white_list_qrcode(){
- $request = request();
- if (!$request->isAjax()) {
- $url = 'https://'.config('app.bosslive_domain').'/saasapi/white_list/qrcode';
- $cmunionid = $this->getcmucode();
- $data = curlparam($url,$cmunionid);
- // 返回数据
- $dataraw = json_decode($data, true);
- View::assign('qrcode', $dataraw['qrcode']);
- View::assign('open', $dataraw['open']);
- View::assign('contacts_qrcode', $dataraw['contacts_qrcode']);
- return View::fetch();
- }
- }
- public function white_list_state(){
- $request = request();
- $state = $request->param('state');
- $url = 'https://'.config('app.bosslive_domain').'/saasapi/white_list/state?state='.$state;
- $cmunionid = $this->getcmucode();
- $data = curlparam($url,$cmunionid);
- // 返回数据
- return $data;
- }
- public function white_list_join(){
- $request = request();
- $id = $request->param('id');
- $url = 'https://'.config('app.bosslive_domain').'/saasapi/white_list/join?id='.$id;
- $cmunionid = $this->getcmucode();
- $data = curlparam($url,$cmunionid);
- // 返回数据
- return $data;
- }
- public function white_list_del(){
- $request = request();
- $id = $request->param('id');
- $url = 'https://'.config('app.bosslive_domain').'/saasapi/white_list/del?id='.$id;
- $cmunionid = $this->getcmucode();
- $data = curlparam($url,$cmunionid);
- // 返回数据
- return $data;
- }
- public function redbag(){
- // $fission = model('fission')->where('cmid', session('company', '', 'live'))->find();
- // $this->assign('money', round($fission->money-$fission->freeze, 2));
- // return $this->fetch();
- $request = request();
- if (!$request->isAjax()) {
- $url = 'https://'.config('app.bosslive_domain').'/saasapi/redbag/redbag_fission_num';
- $cmunionid = $this->getcmucode();
- $data = curlparam($url,$cmunionid);
- $dataarr = json_decode($data,true);
- $money = $dataarr['num'];
- View::assign('money', $money);
- return View::fetch();
- }
- $page = 1;
- if($request->param('page')){
- $page = $request->param('page');
- }
- // 获取分页相关参数
- $url = 'https://'.config('app.bosslive_domain').'/saasapi/redbag/index?page='.$page.'&limit=10';
- $cmunionid = $this->getcmucode();
- $data = curlparam($url,$cmunionid);
- // 返回数据
- return json_decode($data);
- }
- public function answer(){
- $request = request();
- if (!$request->isAjax()) {
- //$url = 'https://'.config('app.bosslive_domain').'/saasapi/redbag/redbag_fission_num';
- //$cmunionid = $this->getcmucode();
- //$data = curlparam($url,$cmunionid);
- //$dataarr = json_decode($data,true);
- //
- //$money = $dataarr['num'];
- //View::assign('money', $money);
- return View::fetch();
- }
- $page = 1;
- if($request->param('page')){
- $page = $request->param('page');
- }
- // 获取分页相关参数
- $url = 'https://'.config('app.bosslive_domain').'/saasapi/answer/index?page='.$page.'&limit=10';
- $cmunionid = $this->getcmucode();
- $data = curlparam($url,$cmunionid);
- // 返回数据
- return json_decode($data);
- }
- public function answer_add(){
- $request = request();
- if (!$request->isAjax()) {
- return View::fetch();
- }
- $title = $request->param('title');
- $like = $request->param('like');
- $valueArr = $request->param('value');
- $value = implode(',', $valueArr);
- // 获取分页相关参数
- $url = 'https://'.config('app.bosslive_domain').'/saasapi/answer/add?title='.$title;
- $url .= '&like='.$like;
- $url .= '&value='.$value;
- $cmunionid = $this->getcmucode();
- $data = curlparam($url,$cmunionid);
- // 返回数据
- return json_decode($data);
- }
- public function answer_log(){
- $request = request();
- if (!$request->isAjax()) {
- $anid = $request->param('anid');
- View::assign('anid', $anid);
- return View::fetch();
- }
- $page = 1;
- if($request->param('page')){
- $page = $request->param('page');
- }
- $anid = $request->param('anid');
- // 获取分页相关参数
- $url = 'https://'.config('app.bosslive_domain').'/saasapi/answer/log?page='.$page.'&limit=10&anid='.$anid;
- if($request->param('success')){
- $success = $request->param('success');
- $url = $url.'&success='.$success;
- }
- $cmunionid = $this->getcmucode();
- $data = curlparam($url,$cmunionid);
- // 返回数据
- return json_decode($data);
- }
- public function answer_push_problem(){
- $request = request();
- $id = $request->param('id');
- $url = 'https://'.config('app.bosslive_domain').'/saasapi/answer/push_problem?id='.$id;
- $cmunionid = $this->getcmucode();
- $data = curlparam($url,$cmunionid);
- // 返回数据
- return $data;
- }
- public function fission(){
- $request = request();
- if (!$request->isAjax()) {
- $url = 'https://'.config('app.bosslive_domain').'/saasapi/fission/fissionsetting';
- $cmunionid = $this->getcmucode();
- $data = curlparam($url,$cmunionid);
- $dataarr = json_decode($data,true);
- $setting = $dataarr['setting'];
- View::assign('data', $setting);
- return View::fetch();
- }
- $page = 1;
- if($request->param('page')){
- $page = $request->param('page');
- }
- // 获取分页相关参数
- $url = 'https://'.config('app.bosslive_domain').'/saasapi/fission/index?page='.$page.'&limit=10';
- $cmunionid = $this->getcmucode();
- $data = curlparam($url,$cmunionid);
- // 返回数据
- return json_decode($data);
- }
- public function chat(){
- $request = request();
- if (!$request->isAjax()) {
- $url = 'https://'.config('app.bosslive_domain').'/saasapi/chat/chat_course_info';
- $cmunionid = $this->getcmucode();
- $data = curlparam($url,$cmunionid);
- // 返回数据
- $dataarr = json_decode($data,true);
- //
- $course = $dataarr['course'];
- $marking_account = $dataarr['marketing_account'];
- // 参数设置
- View::assign('marketing_account', $marking_account);
- View::assign('course', $course);
- return View::fetch();
- }
- $page = 1;
- if($request->param('page')){
- $page = $request->param('page');
- }
- // 获取分页相关参数
- $url = 'https://'.config('app.bosslive_domain').'/saasapi/chat/index?page='.$page.'&limit=10';
- $cmunionid = $this->getcmucode();
- $data = curlparam($url,$cmunionid);
- // 返回数据
- return json_decode($data);
- }
- public function blacklist(){
- $request = request();
- if (!$request->isAjax()) {
- $url = 'https://'.config('app.bosslive_domain').'/saasapi/chat/chat_course_info';
- $cmunionid = $this->getcmucode();
- $data = curlparam($url,$cmunionid);
- // 返回数据
- $dataarr = json_decode($data,true);
- //
- $marking_account = $dataarr['marketing_account'];
- // 参数设置
- View::assign('marketing_account', $marking_account);
- return View::fetch();
- }
- $page = 1;
- if($request->param('page')){
- $page = $request->param('page');
- }
- // 获取分页相关参数
- $url = 'https://'.config('app.bosslive_domain').'/saasapi/blacklist/index?page='.$page.'&limit=10';
- $cmunionid = $this->getcmucode();
- $data = curlparam($url,$cmunionid);
- // 返回数据
- return json_decode($data);
- }
- public function waistcoat(){
- $request = request();
- if (!$request->isAjax()) {
- $url = 'https://'.config('app.bosslive_domain').'/saasapi/chat/chat_course_info';
- $cmunionid = $this->getcmucode();
- $data = curlparam($url,$cmunionid);
- // 返回数据
- $dataarr = json_decode($data,true);
- //
- $marking_account = $dataarr['marketing_account'];
- // 参数设置
- View::assign('marketing_account', $marking_account);
- return View::fetch();
- }
- $page = 1;
- if($request->param('page')){
- $page = $request->param('page');
- }
- // 获取分页相关参数
- $url = 'https://'.config('app.bosslive_domain').'/saasapi/waistcoat/index?page='.$page.'&limit=10';
- $cmunionid = $this->getcmucode();
- $data = curlparam($url,$cmunionid);
- // 返回数据
- return json_decode($data);
- }
- public function waistcoat_add(){
- $request = request();
- if (!$request->isAjax()) {
- return View::fetch();
- }
- $picture = '';
- $rs = $this->ossUploadBosslive('picture', ['jpg', 'png', 'bmp', 'jpeg', 'JPG', 'PNG', 'BMP', 'JPEG']);
- if ($rs['code'] === 0) {
- if (!empty($rs['data']['picture'])) {
- $picture = $rs['data']['picture'];
- }
- }
- $value = $request->param('value');
- // 获取分页相关参数
- $url = 'https://'.config('app.bosslive_domain').'/saasapi/waistcoat/add?value='.$value.'&picture='.$picture;
- $cmunionid = $this->getcmucode();
- $data = curlparam($url,$cmunionid);
- // 返回数据
- return $data;
- }
- public function waistcoat_edit(){
- $request = request();
- $id = $request->param('id');
- $name = $request->param('name');
- // 获取分页相关参数
- $url = 'https://'.config('app.bosslive_domain').'/saasapi/waistcoat/edit?id='.$id.'&name='.$name;
- $cmunionid = $this->getcmucode();
- $data = curlparam($url,$cmunionid);
- // 返回数据
- return $data;
- }
- public function waistcoat_del(){
- $request = request();
- $id = $request->param('id');
- // 获取分页相关参数
- $url = 'https://'.config('app.bosslive_domain').'/saasapi/waistcoat/del?id='.$id;
- $cmunionid = $this->getcmucode();
- $data = curlparam($url,$cmunionid);
- // 返回数据
- return $data;
- }
- public function promoter(){
- $request = request();
- if (!$request->isAjax()) {
- //$this->promoterList();
- $url = 'https://'.config('app.bosslive_domain').'/saasapi/promoter/promoter_course';
- $cmunionid = $this->getcmucode();
- $data = curlparam($url,$cmunionid);
- // 返回数据
- View::assign('course', json_decode($data,true));
- return View::fetch();
- }
- $page = 1;
- if($request->param('page')){
- $page = $request->param('page');
- }
- // 获取分页相关参数
- $url = 'https://'.config('app.bosslive_domain').'/saasapi/promoter/grouplist?page='.$page.'&limit=10';
- if($request->param('cid')){
- $url .= '&cid='.$request->param('cid');
- }
- $cmunionid = $this->getcmucode();
- $data = curlparam($url,$cmunionid);
- // 返回数据
- return json_decode($data);
- }
- private function promoterList(){
- $page = 1;
- // 获取分页相关参数
- $url = 'https://'.config('app.bosslive_domain').'/saasapi/promoter/index?page='.$page.'&limit=10';
- $cmunionid = $this->getcmucode();
- $data = curlparam($url,$cmunionid);
- $dataraw = json_decode($data,true);
- $emplist = [];
- foreach($dataraw['data'] as $item){
- $recordopen = CompanyBossOpen::where('unionid',$item['company']['unionid'])->find();
- if(!$recordopen)return false;
- $emp = Employee::where(['unionid'=>$item['user']['unionid'],'root_id' => $recordopen->id])->find();
- if($emp){
- $emplist[] = ['id' => $emp['id'], 'unionid'=> $emp['unionid'],'org_id' => $emp['org_id'],'root_id' => $emp['root_id'] ];
- }
- }
- //var_dump($emplist);
- // 返回数据
- //return json_decode($data);
- }
- public function promoter_user(){
- $request = request();
- if (!$request->isAjax()) {
- View::assign('param', $request->param());
- return View::fetch();
- }
- $page = 1;
- if($request->param('page')){
- $page = $request->param('page');
- }
- $id= $request->param('id');
- // 获取分页相关参数
- $url = 'https://'.config('app.bosslive_domain').'/saasapi/promoter/user?&id='.$id.'&page='.$page.'&limit=10';
- if($request->param('cid')){
- $cid = $request->param('cid');
- $url = $url.'&cid='.$cid;
- }
- $cmunionid = $this->getcmucode();
- $data = curlparam($url,$cmunionid);
- // 返回数据
- return json_decode($data);
- }
- public function promoter_appoint(){
- $request = request();
- if (!$request->isAjax()) {
- View::assign('param', $request->param());
- return View::fetch();
- }
- $page = 1;
- if($request->param('page')){
- $page = $request->param('page');
- }
- $id= $request->param('id');
- // 获取分页相关参数
- $url = 'https://'.config('app.bosslive_domain').'/saasapi/promoter/appoint?&id='.$id.'&page='.$page.'&limit=10';
- if($request->param('cid')){
- $cid = $request->param('cid');
- $url = $url.'&cid='.$cid;
- }
- $cmunionid = $this->getcmucode();
- $data = curlparam($url,$cmunionid);
- // 返回数据
- return json_decode($data);
- }
- public function promoter_join(){
- $request = request();
- if (!$request->isAjax()) {
- View::assign('param', $request->param());
- return View::fetch();
- }
- $page = 1;
- if($request->param('page')){
- $page = $request->param('page');
- }
- $id= $request->param('id');
- // 获取分页相关参数
- $url = 'https://'.config('app.bosslive_domain').'/saasapi/promoter/join?&id='.$id.'&page='.$page.'&limit=10';
- if($request->param('cid')){
- $cid = $request->param('cid');
- $url = $url.'&cid='.$cid;
- }
- $cmunionid = $this->getcmucode();
- $data = curlparam($url,$cmunionid);
- // 返回数据
- return json_decode($data);
- }
- public function promoter_order(){
- $request = request();
- if (!$request->isAjax()) {
- View::assign('param', $request->param());
- return View::fetch();
- }
- $page = 1;
- if($request->param('page')){
- $page = $request->param('page');
- }
- $id= $request->param('id');
- $id= $request->param('id');
- // 获取分页相关参数
- $url = 'https://'.config('app.bosslive_domain').'/saasapi/promoter/order?&id='.$id.'&page='.$page.'&limit=10';
- if($request->param('cid')){
- $cid = $request->param('cid');
- $url = $url.'&cid='.$cid;
- }
- $cmunionid = $this->getcmucode();
- $data = curlparam($url,$cmunionid);
- // 返回数据
- return json_decode($data);
- }
- public function promoter_scene(){
- $request = request();
- if (!$request->isAjax()) {
- $url = 'https://'.config('app.bosslive_domain').'/saasapi/promoter/promoter_course';
- $cmunionid = $this->getcmucode();
- $data = curlparam($url,$cmunionid);
- // 返回数据
- View::assign('course', json_decode($data,true));
- return View::fetch();
- }
- $page = 1;
- if($request->param('page')){
- $page = $request->param('page');
- }
- // 获取分页相关参数
- $url = 'https://'.config('app.bosslive_domain').'/saasapi/promoter/scene?page='.$page.'&limit=10';
- $cmunionid = $this->getcmucode();
- $data = curlparam($url,$cmunionid);
- // 返回数据
- return json_decode($data);
- }
- public function promoter_qrcode(){
- $request = request();
- $groupId = $request->param('groupId');
- $url = 'https://'.config('app.bosslive_domain').'/saasapi/promoter/qrcode?groupId='.$groupId;
- $cmunionid = $this->getcmucode();
- $data = curlparam($url,$cmunionid);
- // 返回数据
- return $data;
- }
- public function promoter_addgroup(){
- $request = request();
- $name = $request->param('name');
- $url = 'https://'.config('app.bosslive_domain').'/saasapi/promoter/addgroup?name='.$name;
- $cmunionid = $this->getcmucode();
- $data = curlparam($url,$cmunionid);
- // 返回数据
- return $data;
- }
- public function promoter_editgroup(){
- $request = request();
- $id = $request->param('id');
- $name = $request->param('name');
- $url = 'https://'.config('app.bosslive_domain').'/saasapi/promoter/editgroup?id='.$id.'&name='.$name;
- $cmunionid = $this->getcmucode();
- $data = curlparam($url,$cmunionid);
- // 返回数据
- return $data;
- }
- public function promoter_delgroup(){
- $request = request();
- $id = $request->param('id');
- $url = 'https://'.config('app.bosslive_domain').'/saasapi/promoter/delgroup?id='.$id;
- $cmunionid = $this->getcmucode();
- $data = curlparam($url,$cmunionid);
- // 返回数据
- return $data;
- }
- public function customer(){
- $request = request();
- if (!$request->isAjax()) {
- $url = 'https://'.config('app.bosslive_domain').'/saasapi/customer/customer_course';
- $cmunionid = $this->getcmucode();
- $data = curlparam($url,$cmunionid);
- $dataarr = json_decode($data,true);
- View::assign('course', json_decode($data,true));
- return View::fetch();
- }
- $page = 1;
- if($request->param('page')){
- $page = $request->param('page');
- }
- // 获取分页相关参数
- $url = 'https://'.config('app.bosslive_domain').'/saasapi/customer/index?page='.$page.'&limit=10';
- if($request->param('name')){
- $url .= '&name='.$request->param('name');
- }
- if($request->param('nickname')){
- $url .= '&nickname='.$request->param('nickname');
- }
- if($request->param('mobile')){
- $url .= '&mobile='.$request->param('mobile');
- }
- if($request->param('orderNo')){
- $url .= '&orderNo='.$request->param('orderNo');
- }
- if($request->param('courseId')){
- $url .= '&courseId='.$request->param('courseId');
- }
- if($request->param('show') || $request->param('show') == 0){
- $url .= '&show='.$request->param('show');
- }
- $cmunionid = $this->getcmucode();
- $data = curlparam($url,$cmunionid);
- // 返回数据
- return json_decode($data);
- }
- public function order(){
- $request = request();
- if (!$request->isAjax()) {
- return View::fetch();
- }
- $page = 1;
- if($request->param('page')){
- $page = $request->param('page');
- }
- // 获取分页相关参数
- $url = 'https://'.config('app.bosslive_domain').'/saasapi/order/index?page='.$page.'&limit=10';
- if($request->param('name')){
- $url .= '&name='.$request->param('name');
- }
- if($request->param('mobile')){
- $url .= '&mobile='.$request->param('mobile');
- }
- if($request->param('orderNo')){
- $url .= '&orderNo='.$request->param('orderNo');
- }
- if($request->param('course')){
- $url .= '&course='.$request->param('course');
- }
- if($request->param('contact') || $request->param('contact') == 0){
- $url .= '&contact='.$request->param('contact');
- }
- $cmunionid = $this->getcmucode();
- $data = curlparam($url,$cmunionid);
- // 返回数据
- return json_decode($data);
- }
- public function order_no_pay(){
- $request = request();
- if (!$request->isAjax()) {
- return View::fetch();
- }
- $page = 1;
- if($request->param('page')){
- $page = $request->param('page');
- }
- // 获取分页相关参数
- $url = 'https://'.config('app.bosslive_domain').'/saasapi/order/noPay?page='.$page.'&limit=10';
- if($request->param('name')){
- $url .= '&name='.$request->param('name');
- }
- if($request->param('mobile')){
- $url .= '&mobile='.$request->param('mobile');
- }
- if($request->param('course')){
- $url .= '&course='.$request->param('course');
- }
- if($request->param('contact') || $request->param('contact') == 0){
- $url .= '&contact='.$request->param('contact');
- }
- $cmunionid = $this->getcmucode();
- $data = curlparam($url,$cmunionid);
- // 返回数据
- return json_decode($data);
- }
- public function present_order(){
- $request = request();
- if (!$request->isAjax()) {
- $url = 'https://'.config('app.bosslive_domain').'/saasapi/present/present_course';
- $cmunionid = $this->getcmucode();
- $data = curlparam($url,$cmunionid);
- View::assign('course', json_decode($data,true));
- return View::fetch();
- }
- $page = 1;
- if($request->param('page')){
- $page = $request->param('page');
- }
- // 获取分页相关参数
- $url = 'https://'.config('app.bosslive_domain').'/saasapi/present/order?page='.$page.'&limit=10';
- if($request->param('name')){
- $url .= '&name='.$request->param('name');
- }
- if($request->param('course_id')){
- $url .= '&course_id='.$request->param('course_id');
- }
- if($request->param('date')){
- $url .= '&date='.$request->param('date');
- }
- if($request->param('status') || $request->param('status') == 0){
- $url .= '&status='.$request->param('status');
- }
- $cmunionid = $this->getcmucode();
- $data = curlparam($url,$cmunionid);
- // 返回数据
- return json_decode($data);
- }
- public function gift(){
- $request = request();
- if (!$request->isAjax()) {
- $url = 'https://'.config('app.bosslive_domain').'/saasapi/gift/gift_course';
- $cmunionid = $this->getcmucode();
- $data = curlparam($url,$cmunionid);
- $res = json_decode($data,true);
- View::assign('course',$res['course']);
- View::assign('type',$res['gift_tpye']);
- return View::fetch();
- }
- $page = 1;
- if($request->param('page')){
- $page = $request->param('page');
- }
- // 获取分页相关参数
- $url = 'https://'.config('app.bosslive_domain').'/saasapi/gift/index?page='.$page.'&limit=10';
- if($request->param('type')){
- $url .= '&type='.$request->param('type');
- }
- if($request->param('course_id')){
- $url .= '&course_id='.$request->param('course_id');
- }
- $cmunionid = $this->getcmucode();
- $data = curlparam($url,$cmunionid);
- // 返回数据
- return json_decode($data);
- }
- public function order_course_pay(){
- $request = request();
- if (!$request->isAjax()) {
- return View::fetch();
- }
- $page = 1;
- if($request->param('page')){
- $page = $request->param('page');
- }
- // 获取分页相关参数
- $url = 'https://'.config('app.bosslive_domain').'/saasapi/order/coursepay?page='.$page.'&limit=10';
- if($request->param('orderNo')){
- $url .= '&orderNo='.$request->param('orderNo');
- }
- if($request->param('course')){
- $url .= '&course='.$request->param('course');
- }
- if($request->param('status') || $request->param('status') == 0){
- $url .= '&status='.$request->param('status');
- }
- $cmunionid = $this->getcmucode();
- $data = curlparam($url,$cmunionid);
- // 返回数据
- return json_decode($data);
- }
- ////////
- public function course_links()
- {
- $request = request();
- if ( ! $request->isAjax()) {
- $url = 'https://'.config('app.bosslive_domain').'/saasapi/course/links';
- $cmunionid = $this->getcmucode();
- $data = curlparam($url,$cmunionid);
- $dataarr = json_decode($data, true);
- View::assign('imgsrc', $dataarr['imgsrc']);
- View::assign('wylinks', $dataarr['wylinks']);
- View::assign('pushlinks', $dataarr['pushlinks']);
- View::assign('pulllinks', $dataarr['pulllinks']);
- View::assign('sharelink', $dataarr['sharelink']);
- View::assign('sharelinkUrl', $dataarr['sharelinkUrl']);
- View::assign('courseId', $dataarr['courseId']);
- View::assign('courseTitle', $dataarr['courseTitle']);
- return View::fetch();
- }
- }
- ////dashboard
- public function dashboard(){
- $request = request();
- if ( ! $request->isAjax()) {
- $url = 'https://'.config('app.bosslive_domain').'/saasapi/dashboard/dashboard';
- $cmunionid = $this->getcmucode();
- $data = curlparam($url,$cmunionid);
- $dataarr = json_decode($data, true);
- View::assign('domain', $dataarr['domain']);
- View::assign('pushdomain', $dataarr['pushdomain']);
- View::assign('playdomain', $dataarr['playdomain']);
- View::assign('cmid', $dataarr['cmid']);
- View::assign('cmcode', $dataarr['cmcode']);
- View::assign('streamid', $dataarr['streamid']);
- View::assign('courseid', $dataarr['courseid']);
- View::assign('coursetoken', $dataarr['coursetoken']);
- View::assign('coursename', $dataarr['coursename']);
- View::assign('coursecover', $dataarr['coursecover']);
- View::assign('playaddr', $dataarr['playaddr']);
- View::assign('template', $dataarr['template']);
- View::assign('title', $dataarr['title']);
- cache('cid_by_ctoken_'.$dataarr['coursetoken'], $dataarr['courseid'], 10800);//3小时过期
- return View::fetch();
- }
- }
- public function redbagadd()
- {
- $url = 'https://'.config('app.bosslive_domain').'/saasapi/redbag/add';
- $cmunionid = $this->getcmucode();
- $data = curlparam($url,$cmunionid);
- $dataarr = json_decode($data, true);
- View::assign('datetime', $dataarr['datetime']);
- View::assign('cid', $dataarr['cid']);
- View::assign('num', $dataarr['num']);
- View::assign('money', $dataarr['money']);
- View::assign('freeze', $dataarr['freeze']);
- return View::fetch();
- }
- public function redbagsave(){
- $request = request();
- $param = $request->param();
- $price = $param['price'];
- $num = $param['num'];
- $cid = $param['cid'];
- $datetime = $param['datetime'];
- $lineNum = $param['lineNum'];
- // 获取分页相关参数
- $url = 'https://'.config('app.bosslive_domain').'/saasapi/redbag/save?price='.$price.'&num='.$num.'&cid='.$cid.'&datetime='.$datetime.'&lineNum='.$lineNum;
- $cmunionid = $this->getcmucode();
- $data = curlparam($url,$cmunionid);
- // 返回数据
- return json_decode($data);
- }
- public function redbaglog()
- {
- $request = request();
- $rdid = $request->param('id');
- if (!$request->isAjax()) {
- View::assign('id', $rdid);
- return View::fetch();
- }
- $page = 1;
- if($request->param('page')){
- $page = $request->param('page');
- }
- $rdid = $request->param('id');
- $url = 'https://'.config('app.bosslive_domain').'/saasapi/redbag/log?page='.$page.'&limit=10&id='.$rdid;
- $cmunionid = $this->getcmucode();
- $data = curlparam($url,$cmunionid);
- // 返回数据
- return json_decode($data);
- }
- public function fission_qrcode(){
- $url = 'https://'.config('app.bosslive_domain').'/saasapi/fission/qrcode';
- $cmunionid = $this->getcmucode();
- return curlparam($url,$cmunionid);
- }
- public function course_state(){
- $request = request();
- $cid = $request->param('id');
- // 获取分页相关参数
- $url = 'https://'.config('app.bosslive_domain').'/saasapi/course/state?id='.$cid;
- $cmunionid = $this->getcmucode();
- $data = curlparam($url,$cmunionid);
- // 返回数据
- return $data;
- }
- public function course_add(){
- $url = 'https://'.config('app.bosslive_domain').'/saasapi/course/add';
- $cmunionid = $this->getcmucode();
- $data = curlparam($url,$cmunionid);
- $dataarr = json_decode($data, true);
- View::assign('teacher', $dataarr['teacher']);
- View::assign('teacherCount', $dataarr['teacherCount']);
- View::assign('cmid', $dataarr['cmid']);
- return View::fetch();
- }
- public function course_edit(){
- $request = request();
- $id = $request->param('id');
- $url = 'https://'.config('app.bosslive_domain').'/saasapi/course/edit?id='.$id;
- $cmunionid = $this->getcmucode();
- $data = curlparam($url,$cmunionid);
- $dataarr = json_decode($data, true);
- View::assign('teacher', $dataarr['teacher']);
- View::assign('teacherCount', $dataarr['teacherCount']);
- View::assign('cmid', $dataarr['cmid']);
- View::assign('data', $dataarr['data']);
- View::assign('hasgifts', $dataarr['hasgifts']);
- return View::fetch();
- }
- public function course_total(){
- $request = request();
- $cid = $request->param('id');
- // 获取分页相关参数
- $url = 'https://'.config('app.bosslive_domain').'/saasapi/course/total?id='.$cid;
- $cmunionid = $this->getcmucode();
- $data = curlparam($url,$cmunionid);
- // 返回数据
- return $data;
- }
- public function course_recordtheme(){
- $request = request();
- $cid = $request->param('cid');
- $url = 'https://'.config('app.bosslive_domain').'/saasapi/course/recordtheme?cid='.$cid;
- $cmunionid = $this->getcmucode();
- $data = curlparam($url,$cmunionid);
- $dataarr = json_decode($data, true);
- View::assign('cid', $dataarr['cid']);
- return View::fetch();
- }
- public function course_record_list(){
- $request = request();
- $cid = $request->param('cid');
- // 获取分页相关参数
- $url = 'https://'.config('app.bosslive_domain').'/saasapi/course/recordList?cid='.$cid;
- $cmunionid = $this->getcmucode();
- $data = curlparam($url,$cmunionid);
- // 返回数据
- return json_decode($data);
- }
- public function course_use_log(){
- $request = request();
- $cid = $request->param('cid');
- if (!$request->isAjax()) {
- $url = 'https://'.config('app.bosslive_domain').'/saasapi/course/course_use_log?cid='.$cid;
- $cmunionid = $this->getcmucode();
- $data = curlparam($url,$cmunionid);
- $dataarr = json_decode($data, true);
- View::assign('cid', $dataarr['cid']);
- return View::fetch();
- }
- // 获取分页相关参数
- $page = 1;
- if($request->param('page')){
- $page = $request->param('page');
- }
- // 获取分页相关参数
- $url = 'https://'.config('app.bosslive_domain').'/saasapi/course/useLog?cid='.$cid.'&page='.$page.'&limit=10';
- $cmunionid = $this->getcmucode();
- $data = curlparam($url,$cmunionid);
- // 返回数据
- return json_decode($data);
- }
- public function course_appoint(){
- $request = request();
- $cid = $request->param('cid');
- if (!$request->isAjax()) {
- View::assign('cid', $cid);
- return View::fetch();
- }
- // 获取分页相关参数
- $page = 1;
- if($request->param('page')){
- $page = $request->param('page');
- }
- // 获取分页相关参数
- $url = 'https://'.config('app.bosslive_domain').'/saasapi/course/appoint?cid='.$cid.'&page='.$page.'&limit=10';
- $cmunionid = $this->getcmucode();
- $data = curlparam($url,$cmunionid);
- // 返回数据
- return json_decode($data);
- }
- public function course_save(){
- $request = request();
- $data = $request->param();
- $rs = $this->ossUploadBosslive('cover', ['jpg', 'png', 'bmp', 'jpeg', 'JPG', 'PNG', 'BMP', 'JPEG']);
- if ($rs['code'] === 0) {
- if (!empty($rs['data']['cover'])) {
- $data['cover'] = $rs['data']['cover'];
- }
- }
- $paramstr = 'title='.$data['title'].'&description='.$data['description'].'&date='.$data['date'].'&hour='.$data['hour'];
- if (!empty($data['cover'])) {
- $paramstr = $paramstr.'&cover='.$data['cover'];
- }
- $paramstr = $paramstr.'&tid='.$data['tid'].'&content='.$data['content'].'&template='.$data['template'].'&record='.$data['record'].'&open_key='.$data['open_key'];
- $paramstr = $paramstr.'&key='.$data['key'].'&price='.$data['price'];
- if (!empty($data['id'])) {
- $paramstr = $paramstr.'&id='.$data['id'];
- }
- $url = 'https://'.config('app.bosslive_domain').'/saasapi/course/save?'.$paramstr;
- $cmunionid = $this->getcmucode();
- $data = curlparam($url,$cmunionid);
- //$url = 'https://'.config('app.bosslive_domain').'/saasapi/course/save?';
- //$o = "";
- //foreach ( $data as $k => $v )
- //{
- // $o.= "$k=" . urlencode( $v ). "&" ;
- //}
- //$post_data = substr($o,0,-1);
- //$res = curlparampost($url, $post_data);
- // 返回数据
- return json_decode($data);
- }
- private function ossUploadBosslive($path, $exts)
- {
- $path = str_replace('\\', '/', $path);
- $filePath = [];
- // 检测要上传的文件格式是否正确
- foreach ($_FILES as $key => $file) {
- if ($file['size'] == 0) {
- continue;
- }
- $ext = pathinfo($file['name'], PATHINFO_EXTENSION);
- if ( ! in_array($ext, $exts)) {
- return [ 'code' => 1, 'msg' => '文件格式不正确' ];
- }
- $filePath[$key] = [ 'name' => $file['tmp_name'], 'ext' => $ext ];
- }
- $accessKeyId = 'LTAI4FvHHdLarUBHLpJs2YNz';
- $accessKeySecret = 'UEy6HgWOvMWbNqUHxZuBzs35leJHRD';
- $endpoint = 'oss-cn-hangzhou.aliyuncs.com';
- $bucket = 'wzh-live';
- $oss = new OssClient($accessKeyId, $accessKeySecret, $endpoint);
- $path = trim($path, '/');
- $data = [];
- foreach ($filePath as $key => $f) {
- $fileName = date('Ymd').'/'.date('His').rand(1000, 9999).'.'.$f['ext'];
- $p = $path.'/'.$fileName;
- $oss->uploadFile($bucket, $p, $f['name']);
- $data[$key] = $p;
- }
- return [ 'code' => 0, 'data' => $data ];
- }
- //////
- public function customer_msg(){
- $request = request();
- $uid = $request->param('uid');
- if (!$request->isAjax()) {
- View::assign('uid', $uid);
- return View::fetch();
- }
- // 获取分页相关参数
- $page = 1;
- if($request->param('page')){
- $page = $request->param('page');
- }
- $url = 'https://'.config('app.bosslive_domain').'/saasapi/customer/msg?uid='.$uid.'&page='.$page.'&limit=10';
- if($request->param('date')){
- $date = $request->param('date');
- $url = $url.'&date='.$date;
- }
- // 获取分页相关参数
- $cmunionid = $this->getcmucode();
- $data = curlparam($url,$cmunionid);
- // 返回数据
- return json_decode($data);
- }
- public function customer_gift(){
- $request = request();
- $uid = $request->param('uid');
- if (!$request->isAjax()) {
- View::assign('uid', $uid);
- return View::fetch();
- }
- // 获取分页相关参数
- $page = 1;
- if($request->param('page')){
- $page = $request->param('page');
- }
- $url = 'https://'.config('app.bosslive_domain').'/saasapi/customer/gift?uid='.$uid.'&page='.$page.'&limit=10';
- if($request->param('date')){
- $date = $request->param('date');
- $url = $url.'&date='.$date;
- }
- // 获取分页相关参数
- $cmunionid = $this->getcmucode();
- $data = curlparam($url,$cmunionid);
- // 返回数据
- return json_decode($data);
- }
- public function customer_visit(){
- $request = request();
- $uid = $request->param('uid');
- if (!$request->isAjax()) {
- View::assign('uid', $uid);
- return View::fetch();
- }
- // 获取分页相关参数
- $page = 1;
- if($request->param('page')){
- $page = $request->param('page');
- }
- $url = 'https://'.config('app.bosslive_domain').'/saasapi/customer/visit?uid='.$uid.'&page='.$page.'&limit=10';
- if($request->param('date')){
- $date = $request->param('date');
- $url = $url.'&date='.$date;
- }
- // 获取分页相关参数
- $cmunionid = $this->getcmucode();
- $data = curlparam($url,$cmunionid);
- // 返回数据
- return json_decode($data);
- }
- public function customer_redbag(){
- $request = request();
- $uid = $request->param('uid');
- if (!$request->isAjax()) {
- View::assign('uid', $uid);
- return View::fetch();
- }
- // 获取分页相关参数
- $page = 1;
- if($request->param('page')){
- $page = $request->param('page');
- }
- $url = 'https://'.config('app.bosslive_domain').'/saasapi/customer/redbag?uid='.$uid.'&page='.$page.'&limit=10';
- if($request->param('date')){
- $date = $request->param('date');
- $url = $url.'&date='.$date;
- }
- // 获取分页相关参数
- $cmunionid = $this->getcmucode();
- $data = curlparam($url,$cmunionid);
- // 返回数据
- return json_decode($data);
- }
- public function customer_remark(){
- $request = request();
- $uid = $request->param('uid');
- if (!$request->isAjax()) {
- View::assign('uid', $uid);
- return View::fetch();
- }
- // 获取分页相关参数
- $page = 1;
- if($request->param('page')){
- $page = $request->param('page');
- }
- $url = 'https://'.config('app.bosslive_domain').'/saasapi/customer/remark?uid='.$uid.'&page='.$page.'&limit=10';
- if($request->param('date')){
- $date = $request->param('date');
- $url = $url.'&date='.$date;
- }
- // 获取分页相关参数
- $cmunionid = $this->getcmucode();
- $data = curlparam($url,$cmunionid);
- // 返回数据
- return json_decode($data);
- }
- public function customer_doremark(){
- $request = request();
- $uid = $request->param('uid');
- $content = $request->param('content');
- $url = 'https://'.config('app.bosslive_domain').'/saasapi/customer/doremark?uid='.$uid.'&content='.$content;
- // 获取分页相关参数
- $cmunionid = $this->getcmucode();
- $data = curlparam($url,$cmunionid);
- // 返回数据
- return $data;
- }
- public function customer_export(){
- $request = request();
- // 获取分页相关参数
- $page = 1;
- if($request->param('page')){
- $page = $request->param('page');
- }
- $url = 'https://'.config('app.bosslive_domain').'/saasapi/customer/export?page='.$page.'&limit=15';
- if($request->param('name')){
- $url = $url.'&name='.$request->param('name');
- }
- if($request->param('nickname')){
- $url = $url.'&nickname='.$request->param('nickname');
- }
- if($request->param('mobile')){
- $url = $url.'&mobile='.$request->param('mobile');
- }
- if($request->param('courseId')){
- $url = $url.'&courseId='.$request->param('courseId');
- }
- if($request->param('show')){
- $url = $url.'&show='.$request->param('show');
- }
- // 获取分页相关参数
- $cmunionid = $this->getcmucode();
- $data = curlparam($url,$cmunionid);
- // 返回数据
- return $data;
- }
- public function order_edit_contact(){
- $request = request();
- $id = $request->param('id');
- $isContact = $request->param('isContact');
- $url = 'https://'.config('app.bosslive_domain').'/saasapi/order/editContact?id='.$id.'&isContact='.$isContact;
- // 获取分页相关参数
- $cmunionid = $this->getcmucode();
- $data = curlparam($url,$cmunionid);
- // 返回数据
- return $data;
- }
- public function order_contact(){
- $request = request();
- $uid = $request->param('uid');
- $gid = $request->param('gid');
- $cid = $request->param('cid');
- $name = $request->param('name');
- $mobile = $request->param('mobile');
- $isContact = $request->param('isContact');
- $url = 'https://'.config('app.bosslive_domain').'/saasapi/order/contact?uid='.$uid.'&isContact='.$isContact;
- $url = $url.'&gid='.$gid;
- $url = $url.'&cid='.$cid;
- $url = $url.'&name='.$name;
- $url = $url.'&mobile='.$mobile;
- // 获取分页相关参数
- $cmunionid = $this->getcmucode();
- $data = curlparam($url,$cmunionid);
- // 返回数据
- return $data;
- }
- public function order_export(){
- $request = request();
- // 获取分页相关参数
- $page = 1;
- if($request->param('page')){
- $page = $request->param('page');
- }
- $url = 'https://'.config('app.bosslive_domain').'/saasapi/order/export?page='.$page.'&limit=15';
- if($request->param('name')){
- $url = $url.'&name='.$request->param('name');
- }
- if($request->param('mobile')){
- $url = $url.'&mobile='.$request->param('mobile');
- }
- if($request->param('orderNo')){
- $url = $url.'&orderNo='.$request->param('orderNo');
- }
- if($request->param('course')){
- $url = $url.'&course='.$request->param('course');
- }
- if($request->param('contact')){
- $url = $url.'&contact='.$request->param('contact');
- }
- // 获取分页相关参数
- $cmunionid = $this->getcmucode();
- $data = curlparam($url,$cmunionid);
- // 返回数据
- return $data;
- }
- public function present_enter_shop(){
- $request = request();
- $id = $request->param('id');
- $url = 'https://'.config('app.bosslive_domain').'/saasapi/present/enterShop?id='.$id;
- // 获取分页相关参数
- $cmunionid = $this->getcmucode();
- $data = curlparam($url,$cmunionid);
- // 返回数据
- return $data;
- }
- public function goods_edit_sale_num(){
- $request = request();
- $id = $request->param('id');
- $val = $request->param('val');
- $url = 'https://'.config('app.bosslive_domain').'/saasapi/goods/edit_sale_num?id='.$id.'&val='.$val;
- $cmunionid = $this->getcmucode();
- $data = curlparam($url,$cmunionid);
- // 返回数据
- return $data;
- }
- public function goods_edit_queue_num(){
- $request = request();
- $id = $request->param('id');
- $queue = $request->param('queue');
- $url = 'https://'.config('app.bosslive_domain').'/saasapi/goods/edit_queue_num?id='.$id.'&queue='.$queue;
- $cmunionid = $this->getcmucode();
- $data = curlparam($url,$cmunionid);
- // 返回数据
- return $data;
- }
- public function goods_editStatus(){
- $request = request();
- $id = $request->param('id');
- $url = 'https://'.config('app.bosslive_domain').'/saasapi/goods/editStatus?id='.$id;
- $cmunionid = $this->getcmucode();
- $data = curlparam($url,$cmunionid);
- // 返回数据
- return $data;
- }
- public function goods_del(){
- $request = request();
- $id = $request->param('id');
- $url = 'https://'.config('app.bosslive_domain').'/saasapi/goods/del?id='.$id;
- $cmunionid = $this->getcmucode();
- $data = curlparam($url,$cmunionid);
- // 返回数据
- return $data;
- }
- }
|