GroupdoController.class.php 39 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397
  1. <?php
  2. /**
  3. * lionfish 商城系统
  4. *
  5. * 拼团模块
  6. * @author fish
  7. *
  8. */
  9. namespace Home\Controller;
  10. class GroupdoController extends CommonController {
  11. protected function _initialize()
  12. {
  13. parent::_initialize();
  14. }
  15. public function get_goods_detail() {
  16. $_GPC = I('request.');
  17. $id = $_GPC['id'];
  18. $pin_id = isset($_GPC['pin_id']) ? $_GPC['pin_id'] : 0;
  19. $token = $_GPC['token'];
  20. $weprogram_token = M('lionfish_comshop_weprogram_token')->field('member_id')->where( array('token' => $token) )->find();
  21. $member_id = $weprogram_token['member_id'];
  22. $pintuan_model_buy = D('Home/Front')->get_config_by_name('pintuan_model_buy');
  23. if( empty($pintuan_model_buy) || $pintuan_model_buy ==0 )
  24. {
  25. $pintuan_model_buy = 0;
  26. }
  27. //团长休息
  28. $community_id = $_GPC['community_id'];
  29. $is_comunity_rest = D('Seller/Communityhead')->is_community_rest($community_id);
  30. $need_data = array();
  31. $sql = "select g.*,gd.content,gd.begin_time,gd.end_time,gd.video,gd.is_take_fullreduction,gd.share_title,gd.quality,gd.pick_up_type,gd.pick_up_modify,gd.one_limit_count,gd.total_limit_count,gd.seven,gd.repair,gd.labelname,gd.share_title,gd.goods_share_image,gd.relative_goods_list,gd.is_show_arrive,gd.diy_arrive_switch,gd.diy_arrive_details from " . C('DB_PREFIX'). "lionfish_comshop_goods as g," . C('DB_PREFIX') . "lionfish_comshop_good_common as gd
  32. where g.id=gd.goods_id and g.id=" . $id;
  33. $goods_arr = M()->query($sql);
  34. $goods = $goods_arr[0];
  35. $goods['goods_id'] = $id;
  36. $goods['is_take_fullreduction'] = 0;
  37. $goods['is_video'] = 0;
  38. $goods['video_size_width'] = 0;
  39. $goods['vedio_size_height'] = 0;
  40. $goods['video_src'] = '';
  41. if( !empty($goods['goods_share_image']) )
  42. {
  43. $goods['goods_share_image'] = tomedia($goods['goods_share_image']);
  44. }
  45. //video
  46. if( !empty($goods['video']) )
  47. {
  48. $goods['video'] = tomedia($goods['video']);
  49. }
  50. $goods['description'] = htmlspecialchars_decode($goods['content']);
  51. $qian = array(
  52. "\r\n"
  53. );
  54. $hou = array(
  55. "<br/>"
  56. );
  57. $goods['subtitle'] = str_replace($qian, $hou, $goods['subtitle']);
  58. $hou = array(
  59. "@EOF@"
  60. );
  61. $today_time = strtotime( date('Y-m-d').' 00:00:00' );
  62. //pick_up_type
  63. //gd.begin_time,gd.end_time,
  64. //over_type =0 未开始,over_type =2已结束,over_type =1距结束
  65. $now_time = time();
  66. if($goods['begin_time'] > $now_time)
  67. {
  68. $goods['over_type'] = 0;
  69. }else if( $goods['begin_time'] <= $now_time && $goods['end_time'] > $now_time ){
  70. $goods['over_type'] = 1;
  71. }else if($goods['end_time'] < $now_time){
  72. $goods['over_type'] = 2;
  73. $goods['end_date'] = date('m/d H:i', $goods['end_time']);
  74. }
  75. $goods['activity_summary'] = '';
  76. $onegood_image = D('Home/Pingoods')->get_goods_images($id);
  77. if( !empty($onegood_image) )
  78. {
  79. $goods['image_thumb'] = tomedia($onegood_image['image']);
  80. $goods['image'] = tomedia($onegood_image['image']);
  81. }
  82. $buy_record_arr = D('Home/Frontorder')->get_goods_buy_record($id,9);
  83. $goods_image = D('Home/Pingoods')->get_goods_images($id, 10);
  84. if (isset($goods_image)) {
  85. foreach ($goods_image as $k => $v) {
  86. $goods_image[$k]['image'] = tomedia($v['image']);
  87. }
  88. }
  89. $goods['seller_count']+= $goods['sales'];
  90. $goods_price_arr = D('Home/Pingoods')->get_goods_price($id, $member_id);
  91. $goods['price'] = $goods_price_arr['price'];
  92. $goods['danprice'] = $goods_price_arr['danprice'];
  93. $price_dol = explode('.', $goods_price_arr['price']);
  94. $goods['price_front'] = $price_dol[0];
  95. $goods['price_after'] = $price_dol[1];
  96. $labelname_arr = unserialize( $goods['labelname'] );
  97. $tag_arr = array();
  98. if( !empty($labelname_arr) )
  99. {
  100. $goods['tag'] = $labelname_arr;
  101. }else{
  102. if( $goods['quality'] == 1)
  103. {
  104. $tag_arr[] = '正品保证';
  105. }
  106. if( $goods['seven'] == 1)
  107. {
  108. $tag_arr[] = '7天无理由退换';
  109. }
  110. if( $goods['repair'] == 1)
  111. {
  112. $tag_arr[] = '保修';
  113. }
  114. $goods['tag'] = $tag_arr;
  115. }
  116. $goods['fan_image'] = $goods['image'];
  117. $one_image = D('Home/Pingoods')->get_goods_images($id, 1);
  118. $goods['one_image'] = tomedia($one_image['image']);
  119. $pin_info = $goods_price_arr;
  120. $pin_goods_info = M('lionfish_comshop_good_pin')->where( array('goods_id' => $id ) )->find();
  121. $user_favgoods = D('Home/Pingoods')->fav_goods_state($id, $member_id);
  122. if( !empty($user_favgoods) )
  123. {
  124. $goods['favgoods'] = 2;
  125. }else{
  126. $goods['favgoods'] = 1;
  127. }
  128. $price = $goods['danprice'];
  129. $lottery_info = array();
  130. $need_data['lottery_info'] = $lottery_info;
  131. if(empty($goods['share_title'])) $goods['share_title'] = $pin_info['pin_price'].'元 '.$goods['goodsname'];
  132. /** 商品会员折扣begin **/
  133. $is_show_member_disc = 0;
  134. $member_disc = 100;
  135. /** 商品会员折扣end **/
  136. $goods['memberprice'] = sprintf('%.2f', round( ($goods['danprice'] * $member_disc) / 100 ,2));
  137. $max_get_dan_money = round( ($goods['danprice'] * (100 - $max_member_level['discount']) ) / 100 ,2);
  138. $max_get_money = $max_get_dan_money;
  139. if(!empty($pin_info))
  140. {
  141. $pin_info['member_pin_price'] = sprintf('%.2f',round( ($pin_info['pin_price'] * $member_disc) / 100 ,2));
  142. $max_get_pin_money = round( ($pin_info['pin_price'] * (100 - $max_member_level['discount']) ) / 100 ,2);
  143. $max_get_money = $max_get_pin_money;
  144. }
  145. // 商品角标
  146. $label_id = unserialize($goods['labelname']);
  147. if($label_id){
  148. $label_info = D('Home/Pingoods')->get_goods_tags($label_id);
  149. if($label_info){
  150. if($label_info['type'] == 1){
  151. $label_info['tagcontent'] = tomedia($label_info['tagcontent']);
  152. } else {
  153. $label_info['len'] = mb_strlen($label_info['tagcontent'], 'utf-8');
  154. }
  155. }
  156. $goods['label_info'] = $label_info;
  157. }
  158. $pintuan_newman_notice = D('Home/Front')->get_config_by_name('pintuan_newman_notice');
  159. if( !empty($pintuan_newman_notice) )
  160. {
  161. $pintuan_newman_notice = htmlspecialchars_decode($pintuan_newman_notice);
  162. $qian = array(
  163. "\r\n"
  164. );
  165. $hou = array(
  166. "<br/>"
  167. );
  168. $pintuan_newman_notice = str_replace($qian, $hou, $pintuan_newman_notice);
  169. }
  170. $pin_info['is_commiss_tuan'] = $pin_goods_info['is_commiss_tuan'];
  171. $pin_info['is_zero_open'] = $pin_goods_info['is_commiss_tuan'] == 1 ? $pin_goods_info['is_zero_open'] : 0;
  172. $pin_info['is_newman'] = $pin_goods_info['is_newman'];
  173. $pin_info['pintuan_newman_notice'] = $pintuan_newman_notice;
  174. $pin_info['commiss_type'] = $pin_goods_info['commiss_type'];
  175. $pin_info['commiss_money'] = $pin_goods_info['commiss_money'];
  176. //拼团返利开启情况:1、开启,0、关闭
  177. $pin_info['is_pintuan_rebate'] = $pin_goods_info['is_pintuan_rebate'];
  178. $need_data['pin_info'] = $pin_info;
  179. /**
  180. if(!empty($member_id) && $member_id > 0 && $goods[0]['type'] == 'integral')
  181. {
  182. $member_info = M('member')->field('score')->where( array('member_id' => $member_id) )->find();
  183. if($member_info['score'] < $goods[0]['score'])
  184. {
  185. $goods[0]['score_enough'] = 0;
  186. }else{
  187. $goods[0]['score_enough'] = 1;
  188. }
  189. }
  190. **/
  191. $need_data['member_level_info'] = $member_level_info;
  192. $need_data['member_level_list'] = $member_level_list;
  193. $need_data['max_member_level'] = $max_member_level;
  194. $need_data['max_get_money'] = sprintf('%.2f',$max_get_money);
  195. $need_data['max_get_pin_money'] = $max_get_pin_money;
  196. $need_data['max_get_dan_money'] = $max_get_dan_money;
  197. $need_data['buy_record_arr'] = $buy_record_arr;
  198. $need_data['is_show_max_level'] = $is_show_max_level;
  199. $goods['actPrice'] = explode('.', $goods['price']);
  200. $goods['marketPrice'] = explode('.', $goods['productprice']);
  201. ///relative_goods_list member_id
  202. $relative_goods_list = array();
  203. unset($goods['relative_goods_list']);
  204. $need_data['relative_goods_list'] = $relative_goods_list;
  205. $need_data['goods'] = $goods;
  206. $need_data['goods_image'] = $goods_image;
  207. $need_data['site_name'] = D('Home/Front')->get_config_by_name('shoname');
  208. $need_data['options'] = D('Home/Pingoods')->get_goods_options($id, $member_id); // $goods_model->get_goods_options($id);
  209. $order_comment_count = M('lionfish_comshop_order_comment')->where( array('state' => 1, 'goods_id' => $id ) )->count();
  210. $comment_list = array();
  211. if($order_comment_count > 0)
  212. {
  213. $sql = "select o.*,m.username as name2,m.avatar as avatar2 from ".C('DB_PREFIX')."lionfish_comshop_order_comment as o left join ".C('DB_PREFIX')."lionfish_comshop_member as m
  214. on o.member_id=m.member_id
  215. where o.state = 1 and o.goods_id = {$id} order by o.add_time desc limit 1";
  216. $comment_list= M()->query($sql);
  217. $order_comment_images = array();
  218. foreach($comment_list as $key => $val)
  219. {
  220. //user_name
  221. if( empty($val['user_name']) )
  222. {
  223. $val['name'] = $val['name2'];
  224. $val['avatar'] = tomedia($val['avatar2']);
  225. }else{
  226. $val['name'] = $val['user_name'];
  227. $val['avatar'] = tomedia($val['avatar']);
  228. }
  229. if($val['type'] == 0)
  230. {
  231. $order_goods_info = M('lionfish_comshop_order_goods')->field('order_goods_id')->where( array('goods_id' => $id,'order_id' => $val['order_id'] ) )->find();
  232. $order_option_info = M('lionfish_comshop_order_option')->field('value')->where( array('order_goods_id' => $order_goods_info['order_goods_id'],'order_id' => $val['order_id'] ) )->select();
  233. $option_arr = array();
  234. foreach($order_option_info as $option)
  235. {
  236. $option_arr[] = $option['value'];
  237. }
  238. $option_str = implode(',', $option_arr);
  239. }else{
  240. $option_str = '';
  241. }
  242. $img_str = unserialize($val['images']);
  243. if( !empty($img_str) && $img_str != 'undefined' )
  244. {
  245. // $img_str = unserialize($val['images']);
  246. $img_list = explode(',', $img_str);
  247. $need_img_list = array();
  248. foreach($img_list as $kk => $vv)
  249. {
  250. if(!empty($vv) )
  251. {
  252. $vv = tomedia($vv );
  253. $img_list[$kk] = $vv;
  254. $need_img_list[$kk] = $vv;
  255. if(count($order_comment_images) <= 4)
  256. $order_comment_images[] = $vv;
  257. }
  258. }
  259. $val['images'] = $need_img_list ;
  260. } else {
  261. $val['images'] = array();
  262. }
  263. $val['option_str'] = $option_str;
  264. $val['add_time'] = date('Y-m-d', $val['add_time']) ;
  265. $comment_list[$key] = $val;
  266. }
  267. //$this->comment_list = $comment_list;
  268. }
  269. $need_data['cur_time'] = time();
  270. $need_data['pin_id'] = $pin_id;
  271. $need_data['is_show_arrive'] = $goods['is_show_arrive'];
  272. $need_data['diy_arrive_switch'] = $goods['diy_arrive_switch'];
  273. $need_data['diy_arrive_details'] = $goods['diy_arrive_details'];
  274. //团长休息
  275. $goodsdetails_addcart_bg_color = D('Home/Front')->get_config_by_name('goodsdetails_addcart_bg_color');
  276. $goodsdetails_buy_bg_color = D('Home/Front')->get_config_by_name('goodsdetails_buy_bg_color');
  277. $is_close_details_time = D('Home/Front')->get_config_by_name('is_close_details_time');
  278. $pintuan_close_stranger = D('Home/Front')->get_config_by_name('pintuan_close_stranger');
  279. $isopen_community_group_share = D('Home/Front')->get_config_by_name('isopen_community_group_share');
  280. $group_share_info = '';
  281. $is_need_subscript = 0;
  282. $need_subscript_template = array();
  283. if( $member_id >0 )
  284. {
  285. //'pay_order','send_order','hexiao_success','apply_community','open_tuan','take_tuan','pin_tuansuccess','apply_tixian'
  286. $open_tuan_info = M('lionfish_comshop_subscribe')->where( array('member_id' => $member_id, 'type' => 'open_tuan') )->find();
  287. if( empty($open_tuan_info) )
  288. {
  289. $weprogram_subtemplate_open_tuan = D('Home/Front')->get_config_by_name('weprogram_subtemplate_open_tuan');
  290. if( !empty($weprogram_subtemplate_open_tuan) )
  291. {
  292. $need_subscript_template['open_tuan'] = $weprogram_subtemplate_open_tuan;
  293. }
  294. }
  295. $take_tuan_info = M('lionfish_comshop_subscribe')->where( array('member_id' => $member_id, 'type' => 'take_tuan' ) )->find();
  296. if( empty($take_tuan_info) )
  297. {
  298. $weprogram_subtemplate_take_tuan = D('Home/Front')->get_config_by_name('weprogram_subtemplate_take_tuan');
  299. if( !empty($weprogram_subtemplate_take_tuan) )
  300. {
  301. $need_subscript_template['take_tuan'] = $weprogram_subtemplate_take_tuan;
  302. }
  303. }
  304. if( !empty($need_subscript_template) )
  305. {
  306. $is_need_subscript = 1;
  307. }
  308. }
  309. echo json_encode(array(
  310. 'code' => 1,
  311. 'comment_list' => $comment_list,
  312. 'order_comment_images' => $order_comment_images,
  313. 'order_comment_count' => $order_comment_count,
  314. 'data' => $need_data,
  315. 'is_comunity_rest' => $is_comunity_rest,
  316. 'open_man_orderbuy' => $open_man_orderbuy,
  317. 'man_orderbuy_money' => $man_orderbuy_money,
  318. 'goodsdetails_buy_bg_color' => $goodsdetails_buy_bg_color,
  319. 'goodsdetails_addcart_bg_color' => $goodsdetails_addcart_bg_color,
  320. 'isopen_community_group_share' => $isopen_community_group_share,
  321. 'is_need_subscript' => $is_need_subscript,
  322. 'need_subscript_template' => $need_subscript_template,
  323. 'group_share_info' => $group_share_info,
  324. 'is_close_details_time' => $is_close_details_time,
  325. 'pintuan_model_buy' => $pintuan_model_buy,
  326. 'pintuan_close_stranger' => $pintuan_close_stranger
  327. ));
  328. die();
  329. }
  330. public function get_goods_fujin_tuan()
  331. {
  332. $_GPC = I('request.');
  333. $pintuan_model_buy = D('Home/Front')->get_config_by_name('pintuan_model_buy');
  334. if( empty($pintuan_model_buy) )
  335. {
  336. $pintuan_model_buy = 0;
  337. }
  338. $head_id = isset($_GPC['head_id']) ? $_GPC['head_id']:0;
  339. $goods_id = $_GPC['goods_id'];
  340. $limit = isset($_GPC['limit']) ? $_GPC['limit']:8;
  341. $where = "";
  342. if( $pintuan_model_buy == 1 )
  343. {
  344. //o.order_id head_id
  345. $where .= " and o.head_id = {$head_id} ";
  346. }
  347. $pintuan_stranger_zero = D('Home/Front')->get_config_by_name('pintuan_stranger_zero');
  348. if( !isset($pintuan_stranger_zero) || $pintuan_stranger_zero == 0 )
  349. {
  350. $where .= " and o.type !='ignore' ";
  351. }
  352. $fujin_sql = "select distinct(p.pin_id) as pin_id,p.need_count,o.order_id,p.end_time,m.username,m.avatar from ".C('DB_PREFIX')."lionfish_comshop_pin as p,".C('DB_PREFIX')."lionfish_comshop_order_goods as og,".C('DB_PREFIX')."lionfish_comshop_pin_order as po,
  353. ".C('DB_PREFIX')."lionfish_comshop_order as o,".C('DB_PREFIX')."lionfish_comshop_member as m
  354. where p.pin_id = po.pin_id and po.order_id = o.order_id and og.order_id=o.order_id and o.member_id = m.member_id {$where} and o.order_status_id =2 and og.goods_id={$goods_id} and p.end_time>".time()." group by po.pin_id order by p.end_time asc limit {$limit}";
  355. $fujin_countsql = "select distinct(p.pin_id) as pin_id,p.need_count,o.order_id,p.end_time,m.username,m.avatar from ".C('DB_PREFIX')."lionfish_comshop_pin as p,".C('DB_PREFIX')."lionfish_comshop_order_goods as og,".C('DB_PREFIX')."lionfish_comshop_pin_order as po,
  356. ".C('DB_PREFIX')."lionfish_comshop_order as o,".C('DB_PREFIX')."lionfish_comshop_member as m
  357. where p.pin_id = po.pin_id and po.order_id=o.order_id and og.order_id=o.order_id and o.member_id = m.member_id {$where} and o.order_status_id =2 and og.goods_id={$goods_id} and p.end_time>".time()." group by po.pin_id order by p.end_time asc ";
  358. $fujin_tuan_arr_count = M()->query($fujin_countsql );
  359. $fujin_tuan_count = count($fujin_tuan_arr_count);
  360. $fujin_tuan = M()->query($fujin_sql);
  361. $result = array();
  362. if(!empty($fujin_tuan))
  363. {
  364. foreach($fujin_tuan as $pintuan)
  365. {
  366. $buy_count = $this->get_tuan_buy_count($pintuan['pin_id']);
  367. $pintuan['buy_count'] =$buy_count;
  368. $pintuan['cur_interface_time'] = time();
  369. $pintuan['re_need_count'] = $pintuan['need_count'] - $buy_count;
  370. //shipping_city_id
  371. //$pintuan['area_name'] = $area_info['area_name'];
  372. $order_id = $pintuan['order_id'];
  373. if($buy_count > 0)
  374. {
  375. //存在进行中的
  376. $result[] = $pintuan;
  377. }
  378. }
  379. }
  380. if( empty($result) )
  381. {
  382. echo json_encode( array('code' => 1) );
  383. die();
  384. }else{
  385. echo json_encode( array('code' => 0, 'list' => $result, 'count' => $fujin_tuan_count) );
  386. die();
  387. }
  388. }
  389. /**
  390. * 获取拼团已成功购买价数量
  391. */
  392. public function get_tuan_buy_count($pin_id=0)
  393. {
  394. $buy_count_sql = "select count(o.order_id) as count from ".C('DB_PREFIX')."lionfish_comshop_pin as p,".C('DB_PREFIX')."lionfish_comshop_pin_order as po,"
  395. .C('DB_PREFIX')."lionfish_comshop_order_goods as og,
  396. ".C('DB_PREFIX')."lionfish_comshop_order as o
  397. where p.pin_id = po.pin_id and po.order_id=o.order_id and og.order_id = o.order_id and o.order_status_id =2 and p.pin_id={$pin_id} ";
  398. $count_tuan_arr = M()->query($buy_count_sql );
  399. return $count_tuan_arr[0]['count'];
  400. }
  401. function group_info()
  402. {
  403. $_GPC = I('request.');
  404. $interface_get_time = time();
  405. $token = $_GPC['token'];
  406. $order_id = $_GPC['order_id'];
  407. $weprogram_token = M('lionfish_comshop_weprogram_token')->field('member_id')->where( array('token' => $token) )->find();
  408. $member_id = $weprogram_token['member_id'];
  409. if( empty($member_id) )
  410. {
  411. $member_id = 0;
  412. }
  413. $is_show = 0;
  414. //获取拼团商品信息
  415. $order_goods = M('lionfish_comshop_order_goods')->field('name,goods_id,price,total,goods_images,quantity')->where( array('order_id' => $order_id ) )->find();
  416. if(empty($order_goods))
  417. {
  418. //未找到
  419. echo json_encode( array('code' =>1) );
  420. die();
  421. }
  422. //分享标题为购买价格
  423. //$order_goods['price'] = round($order_goods['price'],2);
  424. $order_goods['total'] = round($order_goods['total'],2);
  425. $order_info = M('lionfish_comshop_order')->field('member_id,type,head_id')->where( array('order_id' =>$order_id ) )->find();
  426. $good_image = D('Home/Pingoods')->get_goods_images($order_goods['goods_id']);
  427. if( !empty($good_image) )
  428. {
  429. //$order_goods['goods_images'] = tomedia($good_image['image']);
  430. }
  431. $goods_info = M('lionfish_comshop_goods')->field('goodsname as name,subtitle,productprice ,seller_count,sales as virtual_count,is_all_sale')->where( array('id' => $order_goods['goods_id'] ) )->find();
  432. $goods_desc = M('lionfish_comshop_good_common')->field('share_title as share_group_title')->where( array('goods_id' => $order_goods['goods_id'] ) )->find();
  433. $goods_info['seller_count'] = $goods_info['seller_count'] + $goods_info['virtual_count'];
  434. if( !empty($good_image) )
  435. {
  436. $goods_info['goods_images'] = tomedia($good_image['image']);
  437. }
  438. unset($goods_info['virtual_count']);
  439. $pin_order = M('lionfish_comshop_pin_order')->where( array('order_id' => $order_id ) )->find();
  440. //获取拼团信息
  441. $pin_info = M('lionfish_comshop_pin')->where( array('pin_id' =>$pin_order['pin_id'] ) )->find();
  442. $pintuan_isvirs_success = D('Home/Front')->get_config_by_name('pintuan_isvirs_success');
  443. if( !empty($pintuan_isvirs_success) && $pintuan_isvirs_success == 1 && $pin_info['state'] == 0 && $pin_info['end_time'] < time() )
  444. {
  445. $res = D('Home/Pin')->jia_over_order( $pin_info['pin_id'] );
  446. $pin_info = M('lionfish_comshop_pin')->where( array('pin_id' =>$pin_order['pin_id'] ) )->find();
  447. }
  448. //拼团状态:0进行中, 1成功, 2 已经过期了
  449. if($pin_info['state'] == 0 && $pin_info['end_time'] < time()){
  450. $pin_info['state'] = 2;
  451. }
  452. if( !empty($pin_info['success_time']) )
  453. {
  454. $pin_info['success_time'] = date('Y-m-d H:i:s', $pin_info['success_time']);
  455. }
  456. $goods_info['pin_count'] = $pin_info['need_count'];
  457. $price_arr = D('Home/Pingoods')->get_goods_price($order_goods['goods_id'], $member_id);
  458. $goods_info['pinprice'] = $price_arr['price'];
  459. //分享标题为规格最低价格
  460. $order_goods['price'] = round($price_arr['price'],2);
  461. $goods_info['danprice'] = $price_arr['danprice'];
  462. //ims_
  463. $tuanzhang_info = M('lionfish_comshop_member')->field('member_id,username,telephone,avatar')->where( array('member_id' => $pin_info['user_id'] ) )->find();
  464. $pin_order_sql = "select po.add_time,m.member_id,m.username as name,m.telephone,m.avatar from ".C('DB_PREFIX')."lionfish_comshop_pin_order as po,".C('DB_PREFIX')."lionfish_comshop_order as o,
  465. ".C('DB_PREFIX')."lionfish_comshop_order_goods as og,".C('DB_PREFIX')."lionfish_comshop_member as m
  466. where po.pin_id = ".$pin_info['pin_id']." and o.order_status_id in(1,2,4,6,7,8,9,10,11,14)
  467. and og.order_id = po.order_id and o.order_id = po.order_id and o.member_id= m.member_id order by po.add_time asc ";
  468. $pin_order_arr = M()->query($pin_order_sql);
  469. $me_take_in = 0;
  470. foreach($pin_order_arr as $key =>$val)
  471. {
  472. if($member_id == $val['member_id'])
  473. {
  474. $me_take_in = 1;
  475. }
  476. $pin_order_arr[$key] = $val;
  477. }
  478. //pin_order_arr
  479. if( $pin_info['is_jiqi'] == 1 )
  480. {
  481. $jiapinorder = M('lionfish_comshop_jiapinorder')->where( array('pin_id' => $pin_info['pin_id'] ) )->order('id asc')->select();
  482. if( !empty($jiapinorder) )
  483. {
  484. foreach( $jiapinorder as $vv )
  485. {
  486. $tp_arr_info = array();
  487. $tp_arr_info['add_time'] = $vv['addtime'];
  488. $tp_arr_info['member_id'] = $vv['id'];
  489. $tp_arr_info['name'] = $vv['uname'];
  490. $tp_arr_info['telephone'] = $vv['mobile'];
  491. $tp_arr_info['avatar'] = tomedia( $vv['avatar']);
  492. $pin_order_arr[] = $tp_arr_info ;
  493. }
  494. }
  495. }
  496. $is_me = 0;
  497. if($order_info['member_id'] == $member_id)
  498. {
  499. $is_me = 1;
  500. }
  501. $share_title = "不要错过~我".round($order_goods['price'],2)."元拼了".$goods_info['name'];
  502. if(!empty($goods_desc['share_group_title']) )
  503. {
  504. $share_title = $goods_desc['share_group_title'];
  505. $share_title = str_replace('{pin_price}',round($order_goods['price'],2),$share_title);
  506. $share_title = str_replace('{name}',$goods_info['name'],$share_title);
  507. }
  508. /* 商品规格begin */
  509. /* 商品规格end */
  510. unset( $tuanzhang_info['reg_type'] );
  511. unset( $tuanzhang_info['openid'] );
  512. unset( $tuanzhang_info['we_openid'] );
  513. unset( $tuanzhang_info['bindmobile'] );
  514. unset( $tuanzhang_info['uname'] );
  515. unset( $tuanzhang_info['email'] );
  516. unset( $tuanzhang_info['pwd'] );
  517. unset( $tuanzhang_info['address_id'] );
  518. unset( $tuanzhang_info['share_id'] );
  519. unset( $tuanzhang_info['comsiss_flag'] );
  520. unset( $tuanzhang_info['bind_seller_id'] );
  521. unset( $tuanzhang_info['bind_seller_pickup'] );
  522. unset( $tuanzhang_info['cart'] );
  523. unset( $tuanzhang_info['wishlist'] );
  524. unset( $tuanzhang_info['id_cardreal_name'] );
  525. unset( $tuanzhang_info['id_card'] );
  526. unset( $tuanzhang_info['login_count'] );
  527. unset( $tuanzhang_info['last_login_ip'] );
  528. unset( $tuanzhang_info['last_ip_region'] );
  529. unset( $tuanzhang_info['create_time'] );
  530. unset( $tuanzhang_info['last_login_time'] );
  531. unset( $tuanzhang_info['status'] );
  532. $options = D('Home/Pingoods')->get_goods_options($order_goods['goods_id']);
  533. $need_data = array();
  534. $need_data['is_me'] = $is_me;
  535. $need_data['goods_info'] = $goods_info;
  536. //$need_data['pin_goods'] = $pin_goods;
  537. //$need_data['pin_order'] = $pin_order;
  538. $need_data['me_take_in'] = $me_take_in;
  539. $need_data['share_title'] = $share_title;
  540. //$need_data['tuanzhang_info'] = $tuanzhang_info;
  541. $need_data['pin_order_arr'] = $pin_order_arr;
  542. $need_data['order_goods'] = $order_goods;
  543. $need_data['order_id'] = $order_id;
  544. $need_data['order_type'] = $order_info['type'];
  545. $need_data['community_id'] = $order_info['head_id'];
  546. $need_data['group_order_id'] = $group_order_id;
  547. $need_data['options'] = $options;
  548. $need_data['interface_get_time'] = $interface_get_time;
  549. $need_data['member_id'] = $member_id;
  550. $need_data['del_count'] = $pin_info['need_count'] - count($pin_order_arr);
  551. if( $need_data['del_count'] <= 0 && $pin_info['state'] != 2 )
  552. {
  553. $pin_info['state'] = 1;
  554. }
  555. $need_data['pin_info'] = $pin_info;
  556. $pintuan_model_buy = D('Home/Front')->get_config_by_name('pintuan_model_buy');
  557. if( empty($pintuan_model_buy) || $pintuan_model_buy ==0 )
  558. {
  559. $pintuan_model_buy = 0;
  560. }
  561. $need_data['pintuan_model_buy'] = $pintuan_model_buy;
  562. $hide_community_change_btn = D('Home/Front')->get_config_by_name('hide_community_change_btn');
  563. $need_data['hide_community_change_btn'] = $hide_community_change_btn;
  564. $pintuan_show_community_info = D('Home/Front')->get_config_by_name('pintuan_show_community_info');
  565. $need_data['pintuan_show_community_info'] = $pintuan_show_community_info;
  566. $is_need_subscript = 0;
  567. $need_subscript_template = array();
  568. if( $member_id >0 )
  569. {
  570. $take_tuan_info = M('lionfish_comshop_subscribe')->where( array('member_id' => $member_id, 'type' => 'take_tuan' ) )->find();
  571. if( empty($take_tuan_info) )
  572. {
  573. $weprogram_subtemplate_take_tuan = D('Home/Front')->get_config_by_name('weprogram_subtemplate_take_tuan');
  574. if( !empty($weprogram_subtemplate_take_tuan) )
  575. {
  576. $need_subscript_template['take_tuan'] = $weprogram_subtemplate_take_tuan;
  577. }
  578. }
  579. if( !empty($need_subscript_template) )
  580. {
  581. $is_need_subscript = 1;
  582. }
  583. }
  584. $need_data['is_need_subscript'] = $is_need_subscript;
  585. $need_data['need_subscript_template'] = $need_subscript_template;
  586. echo json_encode( array('code' =>0, 'data' => $need_data) );
  587. die();
  588. }
  589. /***
  590. 获取会员佣金团的收益账户金额
  591. **/
  592. public function get_pincommiss_account_info()
  593. {
  594. $_GPC = I('request.');
  595. $token = $_GPC['token'];
  596. $weprogram_token = M('lionfish_comshop_weprogram_token')->field('member_id')->where( array('token' => $token) )->find();
  597. $member_id = $weprogram_token['member_id'];
  598. if( empty($member_id) )
  599. {
  600. $member_id = 0;
  601. }
  602. $member_info = M('lionfish_comshop_member')->where( array('member_id' => $member_id ) )->find();
  603. if( empty($member_info) )
  604. {
  605. echo json_encode( array('code' => 1,'msg' => '您未登录') );
  606. die();
  607. }
  608. //commission_account($member_id)
  609. D('Home/Pin')->commission_account($member_id);
  610. $pintuan_commiss = M('lionfish_comshop_pintuan_commiss')->where( array('member_id' => $member_id ) )->find();
  611. //可提现金额 money
  612. //待结算金额 ims_lionfish_comshop_pintuan_commiss_order
  613. $wait_statements_money = M('lionfish_comshop_pintuan_commiss_order')->where( array('member_id' =>$member_id,'state' => 0 ) )->sum('money');
  614. //已结算金额 has_statements_money
  615. $has_statements_money = M('lionfish_comshop_pintuan_commiss_order')->where( array('member_id' =>$member_id,'state' => 1 ) )->sum('money');
  616. //已提现金额 getmoney
  617. $pintuan_commiss['wait_statements_money'] = empty($wait_statements_money) ? 0:$wait_statements_money;//待结算金额
  618. $pintuan_commiss['has_statements_money'] = empty($has_statements_money) ? 0 :$has_statements_money;//已结算金额
  619. echo json_encode( array('code' => 0, 'data' => $pintuan_commiss ) );
  620. die();
  621. }
  622. /**
  623. 获取佣金订单列表
  624. **/
  625. public function listorder_list()
  626. {
  627. $_GPC = I('request.');
  628. $token = $_GPC['token'];
  629. $weprogram_token = M('lionfish_comshop_weprogram_token')->field('member_id')->where( array('token' => $token) )->find();
  630. $member_id = $weprogram_token['member_id'];
  631. if( empty($member_id) )
  632. {
  633. $member_id = 0;
  634. }
  635. $member_info = M('lionfish_comshop_member')->where( array('member_id' => $member_id ) )->find();
  636. if( empty($member_info) )
  637. {
  638. echo json_encode( array('code' => 1, 'msg' => '会员不存在') );
  639. die();
  640. }
  641. $per_page = 6;
  642. $page = isset($_GPC['page']) ? $_GPC['page']:1;
  643. $offset = ($page - 1) * $per_page;
  644. $list = array();
  645. $where = '';
  646. $state = isset($_GPC['state']) ? $_GPC['state']: -1;
  647. //state
  648. if($state >=0)
  649. {
  650. $where .= ' and mco.state = '.$state;
  651. }
  652. $sql = 'select mco.money,mco.addtime,mco.statement_time,mco.state,o.order_id,o.order_num_alias,o.order_status_id,
  653. o.order_num_alias,o.total,o.pay_time,o.date_added,og.goods_id,og.quantity,og.name,og.price,og.goods_images,og.order_goods_id,mco.store_id,m.username as uname from '
  654. .C('DB_PREFIX')."lionfish_comshop_pintuan_commiss_order as mco , ".C('DB_PREFIX')."lionfish_comshop_order_goods as og,
  655. ".C('DB_PREFIX')."lionfish_comshop_order as o ,
  656. ".C('DB_PREFIX')."lionfish_comshop_member as m
  657. where mco.order_id=og.order_id and mco.order_id = o.order_id and mco.order_goods_id=og.order_goods_id and m.member_id=o.member_id and mco.member_id=".$member_id." {$where} order by mco.id desc limit {$offset},{$per_page}";
  658. $list = M()->query($sql );
  659. $status_arr = D('Seller/Order')->get_order_status_name();
  660. foreach($list as $key =>$val)
  661. {
  662. $val['total'] = round($val['total'],2);
  663. $val['money'] = round($val['money'],2);
  664. $val['status_name'] = $status_arr[$val['order_status_id']];
  665. //$val['addtime'] = date('Y-m-d H:i:s', $val['addtime']);
  666. unset($val['addtime']);
  667. $val['pay_time'] = date('Y-m-d H:i:s', $val['pay_time']);
  668. $val['date_added'] = date('Y-m-d H:i:s', $val['date_added']);
  669. if( !empty($val['goods_images']))
  670. {
  671. if(is_array($goods_images))
  672. {
  673. $val['goods_images'] = $val['goods_images'];
  674. }else{
  675. $val['goods_images']= tomedia( $val['goods_images'] );
  676. }
  677. }else{
  678. $val['goods_images']= '';
  679. }
  680. $order_option_list = M('lionfish_comshop_order_option')->where( array('order_goods_id' => $val['order_goods_id'] ) )->select();
  681. foreach($order_option_list as $option)
  682. {
  683. $val['option_str'][] = $option['value'];
  684. }
  685. if( !isset($val['option_str']) )
  686. {
  687. $val['option_str'] = '';
  688. }else{
  689. $val['option_str'] = implode(',', $val['option_str']);
  690. }
  691. if( $val['state'] == 1 )
  692. {
  693. $val['statement_time'] = date('Y-m-d H:i:s', $val['statement_time']);
  694. }
  695. $pin_order = M('lionfish_comshop_pin_order')->where( array('order_id' => $val['order_id'] ) )->find();
  696. $pin_info = M('lionfish_comshop_pin')->field('need_count')->where( array('pin_id' => $pin_order['pin_id'] ) )->find();
  697. $val['pin_count'] = $pin_info['need_count'];
  698. $list[$key] = $val;
  699. }
  700. if(empty($list))
  701. {
  702. echo json_encode( array('code' => 1) );
  703. die();
  704. }else {
  705. echo json_encode( array('code' => 0, 'data' => $list) );
  706. die();
  707. }
  708. }
  709. /**
  710. 获取会员拼团佣金基础数据
  711. **/
  712. public function get_commission_info()
  713. {
  714. $_GPC = I('request.');
  715. $token = $_GPC['token'];
  716. $weprogram_token = M('lionfish_comshop_weprogram_token')->field('member_id')->where( array('token' => $token) )->find();
  717. $member_id = $weprogram_token['member_id'];
  718. if( empty($member_id) )
  719. {
  720. $member_id = 0;
  721. }
  722. $member_info = M('lionfish_comshop_member')->where( array('member_id' => $member_id ) )->find();
  723. if( empty($member_info) )
  724. {
  725. echo json_encode( array('code' => 1, 'msg' => '会员不存在') );
  726. die();
  727. }
  728. //最小提现金额
  729. $commiss_min_tixian_money = D('Home/Front')->get_config_by_name('pintuan_min_tixian_money');
  730. if( empty($commiss_min_tixian_money) )
  731. {
  732. $commiss_min_tixian_money = 0;
  733. }
  734. $commiss_tixian_bili = D('Home/Front')->get_config_by_name('pintuan_tixian_bili');
  735. if( empty($commiss_tixian_bili) )
  736. {
  737. $commiss_tixian_bili = 0;
  738. }
  739. $member_commiss = M('lionfish_comshop_pintuan_commiss')->where( array('member_id' => $member_id ) )->find();
  740. $member_commiss['commiss_min_tixian_money'] = $commiss_min_tixian_money;//最小提现金额, 0标识不限制
  741. $member_commiss['commiss_tixian_bili'] = $commiss_tixian_bili;
  742. $member_commiss['total_commiss_money'] = $member_commiss['money'] + $member_commiss['dongmoney'] + $member_commiss['getmoney'];
  743. $commiss_tixianway_yuer = D('Home/Front')->get_config_by_name('pintuan_tixianway_yuer');
  744. $commiss_tixianway_weixin = D('Home/Front')->get_config_by_name('pintuan_tixianway_weixin');
  745. $commiss_tixianway_alipay = D('Home/Front')->get_config_by_name('pintuan_tixianway_alipay');
  746. $commiss_tixianway_bank = D('Home/Front')->get_config_by_name('pintuan_tixianway_bank');
  747. $member_commiss['commiss_tixianway_yuer'] = empty($commiss_tixianway_yuer) ? 1 : ($commiss_tixianway_yuer == 2 ? 1:0);
  748. $member_commiss['commiss_tixianway_weixin'] = empty($commiss_tixianway_weixin) ? 1 : ($commiss_tixianway_weixin == 2 ? 1:0);
  749. $member_commiss['commiss_tixianway_alipay'] = empty($commiss_tixianway_alipay) ? 1 : ($commiss_tixianway_alipay == 2 ? 1:0);
  750. $member_commiss['commiss_tixianway_bank'] = empty($commiss_tixianway_bank) ? 1 : ($commiss_tixianway_bank == 2 ? 1:0);
  751. //上一微信真实姓名
  752. $last_weixin_realname = "";
  753. $last_weixin_info = M('lionfish_comshop_pintuan_tixian_order')->where( array('member_id' => $member_id, 'type' => 2 ) )->find();
  754. if( !empty($last_weixin_info) )
  755. {
  756. $last_weixin_realname = $last_weixin_info['bankusername'];
  757. }
  758. //上一支付宝账号
  759. $last_alipay_name = '';
  760. $last_alipay_account = '';
  761. $last_alipay_info = M('lionfish_comshop_pintuan_tixian_order')->where( array('member_id' => $member_id, 'type' => 3 ) )->find();
  762. if( !empty($last_alipay_info) )
  763. {
  764. $last_alipay_name = $last_alipay_info['bankusername'];
  765. $last_alipay_account = $last_alipay_info['bankaccount'];
  766. }
  767. //上一银行卡信息
  768. $last_bank_bankname = '';
  769. $last_bank_account = '';
  770. $last_bank_name = '';
  771. $last_bank_info = M('lionfish_comshop_pintuan_tixian_order')->where( array('member_id' => $member_id, 'type' => 4 ) )->find();
  772. if( !empty($last_bank_info) )
  773. {
  774. $last_bank_bankname = $last_bank_info['bankname'];
  775. $last_bank_account = $last_bank_info['bankaccount'];
  776. $last_bank_name = $last_bank_info['bankusername'];
  777. }
  778. $member_commiss['last_weixin_realname'] = $last_weixin_realname;
  779. $member_commiss['last_alipay_name'] = $last_alipay_name;
  780. $member_commiss['last_alipay_account'] = $last_alipay_account;
  781. $member_commiss['last_bank_bankname'] = $last_bank_bankname;
  782. $member_commiss['last_bank_account'] = $last_bank_account;
  783. $member_commiss['last_bank_name'] = $last_bank_name;
  784. $commiss_tixian_publish = D('Home/Front')->get_config_by_name('pintuan_tixian_publish');
  785. $member_commiss['commiss_tixian_publish'] = htmlspecialchars_decode( $commiss_tixian_publish );
  786. $member_commiss['total_money'] = sprintf('%.2f', $member_commiss['money'] + $member_commiss['dongmoney'] + $member_commiss['getmoney']);
  787. echo json_encode( array('code' =>0,'data' => $member_commiss) );
  788. die();
  789. }
  790. /**
  791. 会员拼团佣金提现 提交接口
  792. **/
  793. public function tixian_sub()
  794. {
  795. $_GPC = I('request.');
  796. $token = $_GPC['token'];
  797. $weprogram_token = M('lionfish_comshop_weprogram_token')->field('member_id')->where( array('token' => $token) )->find();
  798. $member_id = $weprogram_token['member_id'];
  799. if( empty($member_id) )
  800. {
  801. $member_id = 0;
  802. }
  803. $member_info = M('lionfish_comshop_member')->where( array('member_id' => $member_id ) )->find();
  804. if( empty($member_info) )
  805. {
  806. echo json_encode( array('code' => 1, 'msg' => '会员不存在') );
  807. die();
  808. }
  809. $result = array('code' => 1,'msg' => '提现失败');
  810. $member_commiss = M('lionfish_comshop_pintuan_commiss')->where( array('member_id' => $member_id ) )->find();
  811. $datas = array();
  812. $datas['money'] = $_GPC['money'];
  813. $money = $datas['money'];//I('post.money',0,'floatval');
  814. $type = $_GPC['type'];// 1余额 2 微信 3 支付宝 4 银行
  815. $bankname = isset($_GPC['bankname']) ? $_GPC['bankname'] : ''; //银行名称
  816. $bankaccount = isset($_GPC['bankaccount']) ? $_GPC['bankaccount'] : '';//卡号,支付宝账号 使用该字段
  817. $bankusername = isset($_GPC['bankusername']) ? $_GPC['bankusername'] : '';//持卡人姓名,微信名称,支付宝名称, 使用该字段
  818. $commiss_money_limit = D('Home/Front')->get_config_by_name('pintuan_min_tixian_money');
  819. if(!empty($commiss_money_limit) && $commiss_money_limit >0)
  820. {
  821. if($member_commiss['money'] < $commiss_money_limit)
  822. {
  823. $result['msg'] = '佣金满'.$commiss_money_limit.'才能提现';
  824. echo json_encode($result);
  825. die();
  826. }
  827. }
  828. if($money > 0 && $money <= $member_commiss['money'])
  829. {
  830. //判断提现手续费,+ 判断提现金额免审直接到账
  831. $service_charge = D('Home/Front')->get_config_by_name('pintuan_tixian_bili');
  832. $data = array();
  833. $data['member_id'] = $member_id;
  834. $data['money'] = $money;
  835. $data['service_charge'] = $service_charge;
  836. $data['service_charge_money'] = round( ($money * $service_charge) /100 ,2);
  837. $data['state'] = 0;
  838. $data['shentime'] = 0;
  839. $data['type'] = $type;
  840. $data['bankname'] = $bankname;
  841. $data['bankaccount'] = $bankaccount;
  842. $data['bankusername'] = $bankusername;
  843. $data['addtime'] = time();
  844. M('lionfish_comshop_pintuan_tixian_order')->add($data);
  845. $com_arr = array();
  846. $com_arr['money'] = $member_commiss['money'] - $money;
  847. $com_arr['dongmoney'] = $member_commiss['dongmoney'] + $money;
  848. M('lionfish_comshop_pintuan_commiss')->where( array('member_id' => $member_id ) )->setInc('money',-$money);
  849. M('lionfish_comshop_pintuan_commiss')->where( array('member_id' => $member_id ) )->setInc('dongmoney',$money);
  850. $result['code'] = 0;
  851. //commiss_tixian_reviewed 0 , 1
  852. $commiss_tixian_reviewed = D('Home/Front')->get_config_by_name('pintuan_tixian_reviewed');
  853. if(empty($commiss_tixian_reviewed) || $commiss_tixian_reviewed == 0)
  854. {
  855. //手动
  856. } else if( !empty($commiss_tixian_reviewed) && $commiss_tixian_reviewed == 1 ){
  857. //自动
  858. }
  859. }
  860. echo json_encode($result);
  861. die();
  862. }
  863. /**
  864. 提现记录
  865. **/
  866. public function tixian_record()
  867. {
  868. $_GPC = I('request.');
  869. $token = $_GPC['token'];
  870. $weprogram_token = M('lionfish_comshop_weprogram_token')->field('member_id')->where( array('token' => $token) )->find();
  871. $member_id = $weprogram_token['member_id'];
  872. if( empty($member_id) )
  873. {
  874. $member_id = 0;
  875. }
  876. $member_info = M('lionfish_comshop_member')->where( array('member_id' => $member_id ) )->find();
  877. if( empty($member_info) )
  878. {
  879. echo json_encode( array('code' => 1, 'msg' => '会员不存在') );
  880. die();
  881. }
  882. $per_page = 10;
  883. $page = isset($_GPC['page']) ? $_GPC['page']:1;
  884. $offset = ($page - 1) * $per_page;
  885. $list = array();
  886. $list = M('lionfish_comshop_pintuan_tixian_order')->where( array('member_id' =>$member_id ) )->order('addtime desc')->limit($offset,$per_page )->select();
  887. foreach($list as $key => $val)
  888. {
  889. $val['addtime'] = date('Y-m-d H:i', $val['addtime']);
  890. $list[$key] = $val;
  891. }
  892. if( !empty($list) )
  893. {
  894. echo json_encode( array('code' =>0, 'data'=>$list) );
  895. die();
  896. }else{
  897. echo json_encode( array('code' => 1) );
  898. die();
  899. }
  900. }
  901. }