fetch('',getAdmStoId()); } /** * 商品活动列表 */ public function presalelist() { $getp=I('p'); if (empty($getp)) { $getp=0; } $pagenum=10;//每页显示多少条 if ((int)I('pagenum/s')>0) { $pagenum=I('pagenum/s'); } $oldurl=U('Admin/Presale/presalelist',array( "p"=>$getp )); $this->assign('oldurl',urlencode($oldurl)); $this->assign('pagenum',$pagenum); $this->assign('cur_page',$getp); return $this->fetch('',getAdmStoId()); } public function ajaxpresalelist() { $header[0] ="token:".getylp_token(getERPId()).""; $cur_page=1;//当前页数 if ((int)I('p/s')>0) { $cur_page=I('p/s'); } $ylp_postdata["page"]=$cur_page; $pagenum=10;//每页显示多少条 if ((int)I('pagenum/s')>0) { $pagenum=I('pagenum/s'); $ylp_postdata["pageSize"]=$pagenum; } $startTime = I('startTime') ? trim(I('startTime')) : ''; // 开始时间 $endTime= I('endTime') ? trim(I('endTime')) : ''; // 结束时间 $activityName = I('activityName') ? trim(I('activityName')) : ''; // 活动名称 $activityId= I('activityId') ? trim(I('activityId')) : ''; // 活动编号 $status = I('status');//活动状态 $ylp_postdata["startTime"]=urlencode($startTime); $ylp_postdata["endTime"]=urlencode($endTime); $ylp_postdata["activityName"]=urlencode($activityName); $ylp_postdata["id"]=urlencode($activityId); $ylp_postdata["status"]=$status; $url=parameter_connect($ylp_postdata); mlog($url,"ajaxpresalelist"); $ylpres = httpRequest(YLPBM_URL ."/api/activityb/presell/listPresell/?".$url, 'get',$ylp_postdata,$header); mlog($ylpres,"ajaxpresalelist"); //var_dump($ylpres); //测试 $data=json_decode($ylpres,true); if ($data['code']==0 && $data['data']!=null) { $count = $data['data']['total']; $data = $data['data']['pageData']; } else{ $count=0; $data = $data['data']; } $Page = new AjaxPage($count, $pagenum); $show = $Page->show(); $oldurl=U('Admin/Presale/round_list',array( "pagenum"=>$pagenum, "p"=>$cur_page )); $this->assign('oldurl',urlencode($oldurl)); $this->assign('page',$show); $this->assign('pager',$Page); $this->assign('pagenum',$pagenum); $this->assign('cur_page',$cur_page); $this->assign('goodsList',$data); return $this->fetch('',getAdmStoId()); } public function lpinfo() { $header[0] ="token:".getylp_token(getERPId()).""; $getid=I('goods_id'); $getpostdata["resourceId"] = $getid; $ylpres = httpRequest(YLPZY_URL . "/source/resource/".$getid, 'get', $getpostdata,$header); $data=json_decode($ylpres,true); if ($data['code']==0) { $return_arr = array( 'status' => 0, 'msg' => "", 'giftname'=>$data['data']['resourceName'], 'resourcePrice'=>$data['data']['resourcePrice'], 'imageLink' => $data['data']['resourceImages'][0]['imageLink'], ); } else { $return_arr = array( 'status' => 1, 'msg' => "", ); } return $return_arr; } //全民导购模板 public function ajax_moban() { $header[0] = "token:" . getylp_token(getERPId()) . ""; $is_system=I('is_system/d',0); //模板 $ylpres_moban = httpRequest(YLPHD_URL . "/activityb/template/querylist?type=PRESELL&state=0&page=1&pageSize=1000&is_system=".$is_system, 'get', '', $header); // echo $ylpres_moban; // die; $data = json_decode($ylpres_moban, true); if ($data['code'] == 0) { $getdate = $data['data']['pageData']; } $this->assign('moban', $getdate); return $this->fetch('', getAdmStoId()); } public function addpresale() { $header[0] = "token:" . getylp_token(getERPId()) . ""; //联系电话 //$tel = M('store')->where('store_id', getAdmStoId())->field('store_tel')->find(); $tel =tpCache('shop_info',getAdmStoId()); if ($tel) { $store_tel = $tel['store_tel']; $this->assign('store_tel', $store_tel); } //礼品列表 $ylp_postdata["token"] = getylp_token(getERPId()); $url = parameter_connect($ylp_postdata); $ylpres = httpRequest(YLPZY_URL . "/source/resource/list/?" . $url, 'get'); // mlog($ylpres,"addround"); $data1 = json_decode($ylpres, true); $data1 = $data1['data']['pageData']; $this->assign('lplist', $data1); $type = I('activityId') ? 2 : 1; // 标识自动验证时的 场景 1 表示插入 2 表示更新 if ($type == 2)//获取详细信息 { $hdid = I('activityId'); //活动详细 $ylp_deatil = httpRequest(YLPBM_URL . "/api/activityb/presell/getPresell?activityId=" . $hdid, 'get', '', $header); // echo $ylp_deatil; // die; $deatildata = json_decode($ylp_deatil, true); // mlog($ylp_deatil,"addround"); if ($deatildata['code'] == 0) { $this->assign('deatildata', $deatildata['data']); //当前的礼品 $this->assign('activeing', 1); $newlip = $deatildata['data']['goodsList']; $this->assign('newlip', $newlip); $goods_list1 = $deatildata['data']['goodsList']; $goods_list1 = json_encode($goods_list1); $goods_list1 = json_decode($goods_list1, true); $this->assign('goodsList', $goods_list1); } } $this->initEditor(); // 编辑器 return $this->fetch('', getAdmStoId()); } public function addpresalehand() { $header[0] = "token:" . getylp_token(getERPId()) . ""; if (IS_POST) { $getdata = input('post.'); $getdata=json_encode($getdata); $getdata = json_decode($getdata); //门店查询 $branches=""; // $ylpres_md = httpRequest(YLPSQ_URL . "/company/branch/search", 'get','',$header); // $datamd=json_decode($ylpres_md,true); // if ($datamd['code']==0) // { // $branches=$datamd['data']['pageData'][0]['codeNum']; // } if ($getdata) { $activity_id = $getdata->activity_id;//修改值 不为空为修改 $activity_name = $getdata->activity_name; $start_time = $getdata->start_time; $end_time = $getdata->end_time; $exchange_start_time = $getdata->exchange_start_time; $exchange_end_time = $getdata->exchange_end_time; $phone=$getdata->phone; $firstCommission=$getdata->firstCommission; $secondCommission=$getdata->secondCommission; $originalPrice=$getdata->originalPrice; $price=$getdata->price; $stock=$getdata->stock; $limitation=$getdata->limitation; $template_id = $getdata->template_id; $detail = $getdata->detail; $activity_type = "PRESELL"; if (!empty($activity_id)) { $postdata["activityId"] = $activity_id; } $postdata["templateId"] = $template_id; $postdata["activityName"] = $activity_name; $postdata["startTime"] = $start_time; $postdata["endTime"] = $end_time; $postdata["exchangeStartTime"] = $exchange_start_time; $postdata["exchangeEndTime"] = $exchange_end_time; $postdata["phone"] = $phone; $postdata["originalPrice"] = $originalPrice; $postdata["price"] = $price; $postdata["stock"] = $stock; $postdata["limitation"] = $limitation; $postdata["branches"] =$branches; $postdata["detail"] = $detail; $postdata["firstCommission"] = $firstCommission; $postdata["secondCommission"] = $secondCommission; // $postdata["activity_type"] = $activity_type; $goods_list1 = $getdata->goods_list; $goods_list1 = json_encode($goods_list1); $goods_list1 = json_decode($goods_list1, true); $goods1=""; foreach ($goods_list1 as $k => $v) { $goods_list['goodsId'] = $v['goods_id']; $goods_list['goodsName'] = $v['gift_name']; $goods_list['price'] = $v['price']; $goods_list['imgUrl'] = $v['image']; $goods_list['stock'] = $v['stock']; $goods1[] = $goods_list; } $postdata['goodsListStr'] =json_encode($goods1); $postdata = json_encode($postdata); } $postdata = json_decode($postdata); if (!empty($activity_id)) { $sucessmsg="修改成功!"; $ylpres = httpRequest(YLPBM_URL . "/api/activityb/presell/updatePresell", 'POST', $postdata, $header); } else { upload_ylp_log('C06全民导购活动添加/确认提交'); $sucessmsg="创建成功!"; $ylpres = httpRequest(YLPBM_URL . "/api/activityb/presell/savePresell", 'POST', $postdata, $header); } mlog("返回".$ylpres,"addpresalehand/".getAdmStoId()); $data = json_decode($ylpres, true); if ($data['code'] == 0) { $return_arr = array( 'status' => 0, 'msg' => $sucessmsg, // 'data' => array('url' => $oldurl), ); } else { $return_arr = array( 'status' => -1, 'msg' => $data['msg'], // 'data' => array('url' => $oldurl), ); } $this->ajaxReturn($return_arr); } } /** * 礼品列表 */ public function lplist() { $key_word = I('key_word') ? trim(I('key_word')) : ''; // 关键词搜索 $key_no=I('key_no') ? trim(I('key_no')) : ''; //关键编号 $is_on_sale = I('is_on_sale');//有/无库存 $getp=I('p'); $pagenum=10;//每页显示多少条 if ((int)I('pagenum/s')>0) { $pagenum=I('pagenum/s'); } $oldurl=U('Admin/Presale/lplist',array( "is_on_sale"=>$is_on_sale, "key_word"=>$key_word, "pagenum"=>$pagenum, "p"=>$getp )); $this->assign('oldurl',urlencode($oldurl)); $this->assign('key_word',$key_word); $this->assign('key_no',$key_no); $this->assign('is_on_sale',$is_on_sale==""?2:$is_on_sale); $this->assign('pagenum',$pagenum); $this->assign('cur_page',$getp); return $this->fetch('',getAdmStoId()); } /** * 添加礼品 */ public function addlp() { $oldurl = I('oldurl/s'); if ($oldurl) { $oldurl = urldecode(urldecode($oldurl)); } $this->assign('oldurl', $oldurl); $type = I('id') > 0 ? 2 : 1; // 标识自动验证时的 场景 1 表示插入 2 表示更新 if ($type == 2) { $header[0] = "token:" . getylp_token(getERPId()) . ""; $getid = I('id'); $getpostdata["resourceId"] = $getid; $ylpres = httpRequest(YLPZY_URL . "/source/resource/" . $getid, 'get', $getpostdata, $header); $data = json_decode($ylpres, true); if ($data['code'] == 0) { $this->assign('deatillp', $data['data']); } } //ajax提交验证 if (IS_POST && (I('is_ajax') == 1)) { $data = input('post.'); // mlog(json_encode($data), "addlp"); // $data = "{\"oldurl\":\"\",\"goods_name\":\"\u73c0\u83b1\u96c5\u8702\u871c\u725b\u5976\u51c0\u767d\u4fee\u62a4\u773c\u971c\",\"goods_sn\":\"6948043413309\",\"shop_price\":\"324\",\"original_img\":\"\/public\/upload\/Presale\/temp\/2017\/07-04\/b0ad94438ee4e96ad561223d90a95d12.jpg\",\"store_count\":\"0\",\"goods_content\":\"

232323<\/p>\",\"goods_id\":\"\"}"; $lpid = $data['goods_id']; if (!empty($lpid)) { //更新 $header[0] = "token:" . getylp_token(getERPId()) . ""; $resource["id"] = $lpid; } else { mlog("add","addlp"); $ylp_postdata["token"] = getylp_token(getERPId()); } // if (!empty($data['original_img'])) { $upfilepath = ROOT_PATH . $data['original_img']; if (file_exists($upfilepath)) { $img_data = [ 'img' => $upfilepath, 'imgname' => basename($data['original_img']), ]; $post_data = image_form_data_splice($img_data['img'], $img_data['imgname']); if (!empty($post_data)) { $post_data .= FORM_HYPHENS . FORM_BOUNDARY . FORM_HYPHENS; } $req_headers = [ 'Content-Type: multipart/form-data; boundary=' . FORM_BOUNDARY, ]; $ylpres = httpRequest(YLPZY_URL . "/accounts/imgs", 'POST', $post_data, $req_headers); $data1 = json_decode($ylpres, true); if ($data1['code'] == 0) { $yaccessimg = $data1['data']['download_url']; try { mdelFile($upfilepath); } catch (\Exception $ex) { mlog($ex, "addlp"); } } else { $yaccessimg = $data['original_img']; } } else { $yaccessimg = $data['original_img']; } } // $resource["resourceName"] = $data['goods_name']; $resource["resourceType"] = "GOODS"; $resource["resourceCode"] = $data['goods_sn']; $resource["resourcePrice"] = $data['shop_price']; $resource["surplusStock"] = $data['store_count']; $resource["resourceDetails"] = $data['goods_content']; $resource["resourceImages"] = array(['imageLink' => $yaccessimg]); $ylp_postdata["resource"] = json_encode($resource); mlog(json_encode($ylp_postdata),"addlp"); if (empty($lpid)) { //插入 $ylpres = httpRequest(YLPZY_URL . "/source/resource/add", 'POST', $ylp_postdata); // upload_ylp_log('添加礼品'); $msgstr = "添加成功!"; $data = json_decode($ylpres, true); } else { $ylpres = httpRequest(YLPZY_URL . "/source/resource/update", 'put', $ylp_postdata, $header); // upload_ylp_log('修改礼品'); $data = json_decode($ylpres, true); $msgstr = "修改成功!"; } if ($data['code'] == 0) { $return_arr = array( 'status' => 1, 'msg' => $msgstr, 'data' => array('url' => U('admin/Presale/lplist')), ); } else { $return_arr = array( 'status' => 0, 'msg' => $data['msg'] ); } $this->ajaxReturn($return_arr); } $this->initEditor(); // 编辑器 return $this->fetch('_lipin', getAdmStoId()); } public function testup() { // $streamData = file_get_contents('php://input'); // // mlog($streamData, "testup"); // // $ylp_postdata["token"] =getylp_token(getERPId()); // $ylp_postdata["image"] =$streamData; // $ylpres = httpRequest(YLPIMG_URL . "/accounts/imgs",'POST',$ylp_postdata); // var_dump($ylpres); return $this->fetch('testup',getAdmStoId()); } public function ajaxtestup() { $streamData = file_get_contents('php://input'); mlog($streamData, "testup"); $ylp_postdata["token"] =getylp_token(getERPId()); $ylp_postdata["image"] =$streamData; $ylpres = httpRequest(YLPIMG_URL . "/accounts/imgs",'POST',$ylp_postdata); var_dump($ylpres); return $this->fetch('testup',getAdmStoId()); } /** * 礼品列表 */ public function ajaxlpList(){ // var_dump(getylp_token(getERPId()));die;// $ylp_postdata["token"] =getylp_token(getERPId()); $key_word = I('key_word') ? trim(I('key_word')) : ''; // 关键词搜索 $key_no= I('key_no') ? trim(I('key_no')) : ''; // 关键编号搜索 $is_on_sale = I('is_on_sale');//有库存/无库存 $cur_page=1;//当前页数 if ((int)I('p/s')>0) { $cur_page=I('p/s'); } $ylp_postdata["page"]=$cur_page; $pagenum=10;//每页显示多少条 if ((int)I('pagenum/s')>0) { $pagenum=I('pagenum/s'); $ylp_postdata["pageSize"]=$pagenum; } if($key_word!=="") { $ylp_postdata["resourceName"]=urlencode($key_word); } if($key_no!=="") { $ylp_postdata['logicId']=urlencode($key_no); } if($is_on_sale!=="") { $ylp_postdata["stockState"]=$is_on_sale; } $url=parameter_connect($ylp_postdata); mlog("返回URL:".YLPZY_URL . "/source/resource/list/?".$url,"ajaxlpList/".getAdmStoId()); $ylpres = httpRequest(YLPZY_URL . "/source/resource/list/?".$url, 'get'); mlog("返回:".$ylpres,"ajaxlpList/".getAdmStoId()); $data=json_decode($ylpres,true); $count=$data['data']['total']; $Page = new AjaxPage($count,$pagenum); $show = $Page->show(); $data=$data['data']['pageData']; $oldurl=U('Admin/Presale/lpList',array( "is_on_sale"=>$is_on_sale, "key_word"=>$key_word, "pagenum"=>$pagenum, "p"=>$cur_page )); $this->assign('oldurl',urlencode($oldurl)); $this->assign('key_word',$key_word); $this->assign('key_no',$key_no); $this->assign('page',$show); $this->assign('is_on_sale',$is_on_sale); $this->assign('pager',$Page); $this->assign('pagenum',$pagenum); $this->assign('cur_page',$cur_page); //$this->assign('store_warning_storage',tpCache('basic.warning_storage', getAdmStoId())); //var_dump($data);die; $this->assign('goodsList',$data); return $this->fetch('',getAdmStoId()); } public function dellp(){ $id = $this->request->param('id'); $ylp_postdata["token"] =getylp_token(getERPId()); $url=parameter_connect($ylp_postdata); $ylpres = httpRequest(YLPZY_URL . "/source/resource/delete/".$id."?".$url, 'delete'); $data=json_decode($ylpres,true); if ($data['code']==0) { // upload_ylp_log('删除礼品'); $return_arr = array( 'status' => 1, 'msg' => '操作成功', 'data' => array('url' => U('admin/Presale/lpList')), // 'data' => array('url' => $oldurl), ); } else { $return_arr = array( 'status' => 0, 'msg' => '删除失败', 'data' => array('url' => U('admin/Presale/lpList')), // 'data' => array('url' => $oldurl), ); } $this->ajaxReturn($return_arr); } /** * 兑换列表 */ public function giftstore() { $state = I('state/d'); // 状态 $phone= I('phone'); // 手机号 $qr_code= I('qr_code'); // 兑换码 $activity_name= I('activity_name') ; // 活动名称 $add_time_begin = I('add_time_begin1') ? trim(I('add_time_begin1')) : ''; //购买时间 $add_time_end = I('add_time_end1') ? trim(I('add_time_end1')) : ''; // 购买时间 $exchange_begin_time = I('add_time_begin2') ? trim(I('add_time_begin2')) : ''; // 兑换时间 $exchange_end_time = I('add_time_end2') ? trim(I('add_time_end2')) : ''; // 兑换结束时间 $getp=I('p'); $pagenum=10;//每页显示多少条 if ((int)I('pagenum/s')>0) { $pagenum=I('pagenum/s'); } $oldurl=U('Admin/Presale/gifstore',array( "state"=>$state, "phone"=>$phone, "activity_name"=>$activity_name, "add_time_begin"=>$add_time_begin, "add_time_end"=>$add_time_end, "exchange_begin_time"=>$exchange_begin_time, "exchange_end_time"=>$exchange_end_time, "pagenum"=>$pagenum, )); $this->assign('oldurl',urlencode($oldurl)); $this->assign('state',$state); $this->assign('phone',$phone); $this->assign('activity_name',$activity_name); $this->assign('add_time_begin',$add_time_begin); $this->assign('add_time_end',$add_time_end); $this->assign('exchange_begin_time',$exchange_begin_time); $this->assign('exchange_end_time',$exchange_end_time); $this->assign('pagenum',$pagenum); $this->assign('cur_page',$getp); return $this->fetch('',getAdmStoId()); } /** * 兑换内容加载 */ public function ajaxgiftstore(){ //var_dump(getylp_token(getERPId()));die;getylp_token(getERPId());// $header[0] ="token:".getylp_token(getERPId()).""; $state = I('state/d'); // 状态 $phone= I('phone'); // 手机号 $qr_code= I('qr_code'); // 兑换码 $activity_name= I('activity_name') ; // 活动名称 // $gift_name= I('gift_name'); // 礼品名称 $add_time_begin = I('add_time_begin1') ? trim(I('add_time_begin1')) : ''; //购买时间 $add_time_end = I('add_time_end1') ? trim(I('add_time_end1')) : ''; // 购买时间 $exchange_begin_time = I('add_time_begin2') ? trim(I('add_time_begin2')) : ''; // 兑换时间 $exchange_end_time = I('add_time_end2') ? trim(I('add_time_end2')) : ''; // 兑换结束时间 $cur_page=1;//当前页数 if ((int)I('p/s')>0) { $cur_page=I('p/s'); } $ylp_postdata["page"]=$cur_page; $pagenum=10;//每页显示多少条 if ((int)I('pagenum/s')>0) { $pagenum=I('pagenum/s'); $ylp_postdata["pageSize"]=$pagenum; } if($state!=="") { $ylp_postdata["state"]=$state; } if($phone!=="") { $ylp_postdata['phone']=urlencode($phone); } if($qr_code!=="") { $ylp_postdata["qrCode"]=urlencode($qr_code); } if($activity_name!=="") { $ylp_postdata["activityName"]=urlencode($activity_name); } if($add_time_begin!=="") { $ylp_postdata["buyBeginTime"]=urlencode($add_time_begin); } if($add_time_end!=="") { $ylp_postdata["buyEndTime"]=urlencode($add_time_end); } if($exchange_begin_time!=="") { $ylp_postdata["exchangeBeginTime"]=urlencode($exchange_begin_time); } if($exchange_end_time!=="") { $ylp_postdata["exchangeEndTime"]=urlencode($exchange_end_time); } $url=parameter_connect($ylp_postdata); $excelurl=YLPBM_URL."/api/activityb/exchange/robbuy/export?activityType=PRESELL&token=".getylp_token(getERPId())."&".$url; http://wx.kn.vipzhuang.cn/activityb/presale/queryorder?page=1&pageSize=10&state=3&pay_begin_time=2017-09-12+00:00:00&pay_end_time=2017-09-12+23:59:59&exchange_begin_time=2017-09-12+00:00:00&exchange_end_time=2017-09-12+23:59:59&phone=13599906619&qr_code=123&activity_name=霓虹 $ylpres = httpRequest(YLPBM_URL . "/api/activityb/exchange/robbuy/orders?activityType=PRESELL&".$url, 'get',$ylp_postdata,$header); //$ylpres="{\"code\":0,\"msg\":\"\",\"data\":{\"total\":2,\"page\":1,\"pageSize\":10,\"pageData\":[{\"exchange_user\":\"testsj\",\"exchange_time\":\"2017-06-06 11:51:17\",\"start_time\":\"2017-06-05 11:44:17\",\"end_time\":\"2017-06-11 23:59:00\",\"create_time\":\"2017-06-05 14:13:14\",\"phone\":\"18620612806\",\"qr_code\":\"805869280851\",\"state\":1,\"gift_name\":\"卡姿兰(Carslan)致美靓颜基础套装\",\"id\":2868,\"activity_name\":\"花Young大转盘\"},{\"exchange_user\":\"testsj\",\"exchange_time\":\"2017-06-06 11:51:19\",\"start_time\":\"2017-06-05 11:44:17\",\"end_time\":\"2017-06-11 23:59:00\",\"create_time\":\"2017-06-05 11:50:01\",\"phone\":\"18620612806\",\"qr_code\":\"805558299750\",\"state\":1,\"gift_name\":\"卡姿兰彩妆套装全套组合 初学者淡妆裸妆美妆化妆品套装 含美妆工具 3#自然妆\",\"id\":2868,\"activity_name\":\"花Young大转盘\"}]}}"; // mlog($ylpres,"ajaxgiftstore"); $data=json_decode($ylpres,true); // var_dump($data); // die(); if ($data['code']==0) { $count = $data['data']['total']; $data = $data['data']['pageData']; } else { $count = 0; $data = ""; } $Page = new AjaxPage($count, $pagenum); $show = $Page->show(); $oldurl=U('Admin/Presale/gifstore',array( "state"=>$state, "phone"=>$phone, "activity_name"=>$activity_name, "add_time_begin"=>$add_time_begin, "add_time_end"=>$add_time_end, "exchange_begin_time"=>$exchange_begin_time, "exchange_end_time"=>$exchange_end_time, "pagenum"=>$pagenum, "p"=>$cur_page )); $this->assign('oldurl',urlencode($oldurl)); $this->assign('page',$show); $this->assign('pager',$Page); $this->assign('pagenum',$pagenum); $this->assign('cur_page',$cur_page); //var_dump($data);die; $this->assign('excelurl',$excelurl); $this->assign('goodsList',$data); return $this->fetch('',getAdmStoId()); } public function orderdetail() { $header[0] ="token:".getylp_token(getERPId()).""; $id = I('id/d'); // ID $ylp_postdata['orderId']=$id; $url=parameter_connect($ylp_postdata); $ylpres = httpRequest(YLPBM_URL . "/api/activityb/exchange/robbuy/goods?".$url, 'get',$ylp_postdata,$header); //$ylpres="{\"code\":0,\"msg\":\"\",\"data\":[{\"id\":20658,\"order_id\":123456,\"state\":0,\"create_time\":\"2017-09-01 16:51:59\",\"overdue_time\":\"2019-09-01 16:51:59\",\"exchange_user\":\"wxd\",\"exchange_time\":\"2017-09-09 16:51:59\",\"goodsName\":\"测试\"}]}"; $data=json_decode($ylpres,true); if ($data['code']==0) { $data = $data['data']; } else { $data = ""; } return $data; //exit(json_encode($data)); } /** * 数据列表 */ public function businessdatalist() { $header[0] ="token:".getylp_token(getERPId()).""; $activityId = I('activityId') ? trim(I('activityId')) : ''; // 活动Id $ylp_postdata["token"] =getylp_token(getERPId()); $ylp_postdata["activityId"]=$activityId;//$activityId; $url=parameter_connect($ylp_postdata); $ylpres = httpRequest(YLPBM_URL . "/api/activityb/business/overview/getPresell?".$url, 'get',$ylp_postdata,$header); // var_dump($ylpres);die; //$ylpres="{\"code\":0,\"data\":{\"totalPv\":2,\"totalUv\":1,\"totalExchangeCount\":2,\"totalShareCount\":1,\"totalParticipateCount\":2,\"totalWinCount\":2},\"msg\":\"获取大转盘数据成功!\"}"; $data=json_decode($ylpres,true); //var_dump($data); if ($data['code']==0) { $data=$data['data']; } $this->assign('datacount',$data); $getp=I('p'); $pagenum=10;//每页显示多少条 if ((int)I('pagenum/s')>0) { $pagenum=I('pagenum/s'); } $this->assign('activityId',$activityId); $this->assign('pagenum',$pagenum); $this->assign('cur_page',$getp); return $this->fetch('',getAdmStoId()); } /** * 数据内容加载 */ public function ajaxbusinessdata(){ //var_dump(getylp_token(getERPId()));die;getylp_token(getERPId());// $header[0] ="token:".getylp_token(getERPId()).""; $activityId = I('activityId') ? trim(I('activityId')) : ''; // 活动Id $cur_page=1;//当前页数 if ((int)I('p/s')>0) { $cur_page=I('p/s'); } $ylp_postdata["page"]=$cur_page; $pagenum=10;//每页显示多少条 if ((int)I('pagenum/s')>0) { $pagenum=I('pagenum/s'); $ylp_postdata["pageSize"]=$pagenum; } if(!empty($activityId)) { $ylp_postdata["activityId"]=$activityId; } $url=parameter_connect($ylp_postdata); $excelurl=YLPBM_URL."/api/activityb/business/overview/exportPresellList?token=".getylp_token(getERPId())."&".$url; $ylpres = httpRequest(YLPBM_URL . "/api/activityb/business/overview/getPresellList?".$url, 'get',$ylp_postdata,$header); //$ylpres="{\"code\":0,\"data\":{\"total\":18,\"page\":1,\"pageSize\":10,\"pageData\":[{\"recordTime\":\"2017-06-11 00:00:00\",\"pv\":0,\"uv\":0,\"shareCount\":0,\"participateCount\":0,\"participatePeopleCount\":0,\"winCount\":0,\"winPeopleCount\":0,\"exchangeCount\":0},{\"recordTime\":\"2017-06-10 00:00:00\",\"pv\":0,\"uv\":0,\"shareCount\":0,\"participateCount\":0,\"participatePeopleCount\":0,\"winCount\":0,\"winPeopleCount\":0,\"exchangeCount\":0},{\"recordTime\":\"2017-06-09 00:00:00\",\"pv\":0,\"uv\":0,\"shareCount\":0,\"participateCount\":0,\"participatePeopleCount\":0,\"winCount\":0,\"winPeopleCount\":0,\"exchangeCount\":0},{\"recordTime\":\"2017-06-08 00:00:00\",\"pv\":0,\"uv\":0,\"shareCount\":0,\"participateCount\":0,\"participatePeopleCount\":0,\"winCount\":0,\"winPeopleCount\":0,\"exchangeCount\":0},{\"recordTime\":\"2017-06-07 00:00:00\",\"pv\":4,\"uv\":2,\"shareCount\":0,\"participateCount\":0,\"participatePeopleCount\":0,\"winCount\":0,\"winPeopleCount\":0,\"exchangeCount\":0},{\"recordTime\":\"2017-06-06 00:00:00\",\"pv\":0,\"uv\":0,\"shareCount\":0,\"participateCount\":0,\"participatePeopleCount\":0,\"winCount\":0,\"winPeopleCount\":0,\"exchangeCount\":0},{\"recordTime\":\"2017-06-05 00:00:00\",\"pv\":0,\"uv\":0,\"shareCount\":0,\"participateCount\":0,\"participatePeopleCount\":0,\"winCount\":0,\"winPeopleCount\":0,\"exchangeCount\":0},{\"recordTime\":\"2017-06-04 00:00:00\",\"pv\":0,\"uv\":0,\"shareCount\":0,\"participateCount\":0,\"participatePeopleCount\":0,\"winCount\":0,\"winPeopleCount\":0,\"exchangeCount\":0},{\"recordTime\":\"2017-06-03 00:00:00\",\"pv\":8,\"uv\":2,\"shareCount\":0,\"participateCount\":0,\"participatePeopleCount\":0,\"winCount\":0,\"winPeopleCount\":0,\"exchangeCount\":0},{\"recordTime\":\"2017-06-02 00:00:00\",\"pv\":0,\"uv\":0,\"shareCount\":0,\"participateCount\":0,\"participatePeopleCount\":0,\"winCount\":0,\"winPeopleCount\":0,\"exchangeCount\":0}]},\"msg\":\"获取大转盘数据统计列表成功!\"}"; $data=json_decode($ylpres,true); //var_dump($data); //die(); if ($data['code']==0) { $count = $data['data']['total']; $data = $data['data']['pageData']; } else { $count = 0; $data = ""; } $Page = new AjaxPage($count, $pagenum); $show = $Page->show(); $this->assign('page',$show); $this->assign('pager',$Page); $this->assign('pagenum',$pagenum); $this->assign('cur_page',$cur_page); $this->assign('excelurl',$excelurl); //var_dump($data);die; $this->assign('goodsList',$data); return $this->fetch('',getAdmStoId()); } private function initEditor() { $this->assign("URL_upload", U('Admin/Ueditor/imageUp', array('savepath' => 'Presale'))); $this->assign("URL_fileUp", U('Admin/Ueditor/fileUp', array('savepath' => 'Presale'))); $this->assign("URL_scrawlUp", U('Admin/Ueditor/scrawlUp', array('savepath' => 'Presale'))); $this->assign("URL_getRemoteImage", U('Admin/Ueditor/getRemoteImage', array('savepath' => 'Presale'))); $this->assign("URL_imageManager", U('Admin/Ueditor/imageManager', array('savepath' => 'Presale'))); $this->assign("URL_imageUp", U('Admin/Ueditor/imageUp', array('savepath' => 'Presale'))); $this->assign("URL_getMovie", U('Admin/Ueditor/getMovie', array('savepath' => 'Presale'))); $this->assign("URL_Home", ""); } }