MemberModel.class.php 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710
  1. <?php
  2. /**
  3. * lionfish 商城系统
  4. *
  5. *
  6. * @author fish
  7. *
  8. */
  9. namespace Admin\Model;
  10. class MemberModel{
  11. /**
  12. *显示分页
  13. */
  14. public function show_member_page($search){
  15. $sql="select * from ".C('DB_PREFIX')."member where 1 ";
  16. if(isset($search['name'])){
  17. $sql.=" and uname like '%".$search['name']."%'";
  18. }
  19. if(isset($search['email'])){
  20. $sql.=" and email='".$search['email']."'";
  21. }
  22. if(isset($search['tel'])){
  23. $sql.=" and telephone='".$search['tel']."'";
  24. }
  25. if(isset($search['level_id'])){
  26. $sql.=" and level_id='".$search['level_id']."'";
  27. }
  28. //level_id
  29. $count=count(M()->query($sql));
  30. $Page = new \Think\Page($count,C('BACK_PAGE_NUM'));
  31. $show = $Page->show();// 分页显示输出
  32. $sql.=' order by member_id desc LIMIT '.$Page->firstRow.','.$Page->listRows;
  33. $list=M()->query($sql);
  34. $member_model = D('Home/Member');
  35. $level_data=$this->show_member_level();
  36. $member_default_levelname_info = M('config')->where( array('name' => 'member_default_levelname') )->find();
  37. $member_defualt_discount_info = M('config')->where( array('name' => 'member_defualt_discount') )->find();
  38. $default = array('id'=>'0', 'level' => 0,'levelname' => $member_default_levelname_info['value'],'discount' => $member_defualt_discount_info['value']);
  39. array_unshift($level_data['list'], $default );
  40. $need_level = array();
  41. foreach($level_data['list'] as $vv)
  42. {
  43. $need_level[ $vv['id'] ] = $vv['levelname'];
  44. }
  45. foreach($list as $key => $val)
  46. {
  47. //comsiss_flag
  48. if($val['comsiss_flag'] == 1)
  49. {
  50. $member_commiss = M('member_commiss')->where( array('member_id' => $val['member_id'] ) )->find();
  51. $total_wait_where = array();
  52. $total_wait_where['member_id'] = $val['member_id'];
  53. $total_wait_where['state'] = 0;
  54. $total_wait_commiss = $member_model->sum_member_commiss($total_wait_where);
  55. $all_commiss_money = $total_wait_commiss + $member_commiss['money'] +$member_commiss['getmoney']+$member_commiss['dongmoney'];
  56. $member_commiss['all_commiss_money'] = $all_commiss_money;
  57. $member_commiss['wait_money'] = $total_wait_commiss;
  58. $val['member_commiss'] = $member_commiss;
  59. }
  60. $val['level_name'] = $need_level[ $val['level_id'] ];
  61. //
  62. $list[$key] = $val;
  63. }
  64. return array(
  65. 'empty'=>'<tr><td colspan="20">~~暂无数据</td></tr>',
  66. 'list'=>$list,
  67. 'page'=>$show
  68. );
  69. }
  70. public function levelconfig($data)
  71. {
  72. M('config')->where( array('name' => 'member_level_is_open') )->save( array('value' => $data['member_level_is_open']) );
  73. return array(
  74. 'status'=>'success',
  75. 'message'=>'操作成功',
  76. 'jump'=>U('Member/levelconfig')
  77. );
  78. }
  79. public function check_updategrade( $member_id )
  80. {
  81. $pay_money = M('lionfish_comshop_order')->where("member_id={$member_id} and order_status_id in(6,11)")->sum('total+shipping_fare-voucher_credit-fullreduction_money');
  82. $pay_money = empty($pay_money) ? 0 : $pay_money;
  83. $mb_info = M('lionfish_comshop_member')->where( array('member_id' => $member_id ) )->find();
  84. if( !empty($mb_info) )
  85. {
  86. $next_level = M('lionfish_comshop_member_level')->where( "id >".$mb_info['level_id']." and is_auto_grade =1 " )->order('id asc')->find();
  87. if( !empty($next_level) && $pay_money >= $next_level['level_money'] )
  88. {
  89. M('lionfish_comshop_member')->where( array('member_id' => $member_id) )->save( array('level_id' => $next_level['id']) );
  90. }
  91. }
  92. }
  93. /**
  94. 更改会员余额
  95. **/
  96. public function sendMemberMoneyChange($member_id, $num, $changetype, $remark='')
  97. {
  98. $member_info = M('lionfish_comshop_member')->field('account_money')->where( array('member_id' => $member_id) )->find();
  99. $account_money = $member_info['account_money'];
  100. $flow_data = array();
  101. $flow_data['member_id'] = $member_id;
  102. $flow_data['trans_id'] = '';
  103. //0,未支付,1已支付,3余额付款,4退款到余额,5后台充值 6 后台扣款 11兑换卡兑换
  104. //增加 operate_end_yuer
  105. if($changetype == 0)
  106. {
  107. $up_sql = "update ".C('DB_PREFIX')."lionfish_comshop_member set account_money = account_money+ ".$num ." where member_id=".$member_id;
  108. $flow_data['state'] = '5';
  109. }
  110. else if($changetype == 1)
  111. {
  112. //减少
  113. $up_sql = "update ".C('DB_PREFIX')."lionfish_comshop_member set account_money = account_money - ".$num ." where member_id=".$member_id;
  114. $flow_data['state'] = '8';
  115. }else if($changetype == 2){
  116. //最终积分
  117. $up_sql = "update ".C('DB_PREFIX')."lionfish_comshop_member set account_money = ".$num ." where member_id=".$member_id;
  118. if($account_money >= $num)
  119. {
  120. $flow_data['state'] = '8';
  121. $num = $account_money - $num;
  122. }else{
  123. $flow_data['state'] = '5';
  124. $num = $num - $account_money;
  125. }
  126. }else if( $changetype == 9 )
  127. {
  128. $up_sql = "update ".C('DB_PREFIX')."lionfish_comshop_member set account_money = account_money+ ".$num ." where member_id=".$member_id;
  129. $flow_data['state'] = '9';
  130. }
  131. else if( $changetype == 10 )
  132. {
  133. $up_sql = "update ".C('DB_PREFIX')."lionfish_comshop_member set account_money = account_money+ ".$num ." where member_id=".$member_id;
  134. $flow_data['state'] = '10';
  135. }
  136. else if( $changetype == 20 )
  137. {
  138. //11兑换卡兑换
  139. $up_sql = "update ".C('DB_PREFIX')."lionfish_comshop_member set account_money = account_money+ ".$num ." where member_id=".$member_id;
  140. $flow_data['state'] = '20';
  141. }
  142. M()->execute($up_sql);
  143. $member_info = M('lionfish_comshop_member')->field('account_money')->where( array('member_id' => $member_id) )->find();
  144. $account_money = $member_info['account_money'];
  145. $flow_data['money'] = $num;
  146. $flow_data['operate_end_yuer'] = $account_money;
  147. $flow_data['remark'] = $remark;
  148. $flow_data['charge_time'] = time();
  149. $flow_data['add_time'] = time();
  150. M('lionfish_comshop_member_charge_flow')->add($flow_data);
  151. }
  152. /**
  153. 更新会员积分
  154. **/
  155. public function sendMemberPointChange($member_id,$num, $changetype ,$remark ='',$type='system_add', $order_id =0 ,$order_goods_id = 0)
  156. {
  157. //$profile['member_id'], $num, $changetype, $remark
  158. $member_info = M('lionfish_comshop_member')->field('score')->where( array('member_id' => $member_id) )->find();
  159. $member_score = $member_info['score'];
  160. $flow_data = array();
  161. $flow_data['member_id'] = $member_id;
  162. $flow_data['type'] = $type;
  163. $flow_data['order_id'] = $order_id;
  164. $flow_data['order_goods_id'] = $order_goods_id;
  165. //增加
  166. if($changetype == 0)
  167. {
  168. $up_sql = "update ".C('DB_PREFIX')."lionfish_comshop_member set score = score+ ".$num ." where member_id=".$member_id;
  169. $flow_data['in_out'] = 'in';
  170. }else if($changetype == 1)
  171. {
  172. //减少
  173. $up_sql = "update ".C('DB_PREFIX')."lionfish_comshop_member set score = score - ".$num ." where member_id=".$member_id;
  174. $flow_data['in_out'] = 'out';
  175. }else if($changetype == 2){
  176. //最终积分
  177. $up_sql = "update ".C('DB_PREFIX')."lionfish_comshop_member set score = ".$num ." where member_id=".$member_id;
  178. if($member_score >= $num)
  179. {
  180. $flow_data['in_out'] = 'out';
  181. $num = $member_score - $num;
  182. }else{
  183. $flow_data['in_out'] = 'in';
  184. $num = $num - $member_score;
  185. }
  186. }
  187. $flow_data['score'] = $num;
  188. $flow_data['state'] = 1;
  189. $flow_data['remark'] = $remark;
  190. $flow_data['addtime'] = time();
  191. M()->execute($up_sql);
  192. $member_score_info = M('lionfish_comshop_member')->field('score')->where( array('member_id' => $member_id) )->find();
  193. $flow_data['after_operate_score'] = $member_score_info['score'];
  194. M('lionfish_comshop_member_integral_flow')->add( $flow_data );
  195. }
  196. ///end
  197. public function addlevel($data)
  198. {
  199. //member_level id
  200. /**
  201. array(4) { ["level"]=> string(1) "1" ["levelname"]=> string(7) "等级1" ["discount"]=> string(2) "10" ["send"]=> string(6) "提交" }
  202. **/
  203. // M('member_level')->where()->save();
  204. if( isset($data['id']) && !empty($data['id']) )
  205. {
  206. if($data['id'] == 'default')
  207. {
  208. M('config')->where( array('name' => 'member_default_levelname') )->save( array('value' => $data['levelname']) );
  209. M('config')->where( array('name' => 'member_defualt_discount') )->save( array('value' => $data['discount']) );
  210. }else{
  211. M('member_level')->where( array('id' =>$data['id']) )->save($data);
  212. }
  213. }else{
  214. M('member_level')->add($data);
  215. }
  216. return array(
  217. 'status'=>'success',
  218. 'message'=>'操作成功',
  219. 'jump'=>U('Member/level')
  220. );
  221. }
  222. public function show_member_level()
  223. {
  224. $sql="select * from ".C('DB_PREFIX')."member_level where 1 ";
  225. $count=count(M()->query($sql));
  226. $Page = new \Think\Page($count,C('BACK_PAGE_NUM'));
  227. $show = $Page->show();// 分页显示输出
  228. $sql.=' order by level asc LIMIT '.$Page->firstRow.','.$Page->listRows;
  229. $list=M()->query($sql);
  230. /**
  231. foreach($list as $key => $val)
  232. {
  233. $list[$key] = $val;
  234. }
  235. **/
  236. return array(
  237. 'empty'=>'<tr><td colspan="20">~~暂无数据</td></tr>',
  238. 'list'=>$list,
  239. 'page'=>$show
  240. );
  241. }
  242. public function show_member_charge_page($search)
  243. {
  244. //member_id state
  245. $sql="select * from ".C('DB_PREFIX')."member_charge_flow where 1 ";
  246. if(isset($search['member_id'])){
  247. $sql.=" and member_id='".$search['member_id']."'";
  248. }
  249. if(isset($search['state'])){
  250. $sql.=" and state= ".$search['state'];
  251. }
  252. $count=count(M()->query($sql));
  253. $Page = new \Think\Page($count,C('BACK_PAGE_NUM'));
  254. $show = $Page->show();// 分页显示输出
  255. $sql.=' order by id desc LIMIT '.$Page->firstRow.','.$Page->listRows;
  256. $list=M()->query($sql);
  257. foreach( $list as $key =>$val )
  258. {
  259. if($val['state'] == 6)
  260. {
  261. $trans_id = $val['trans_id'];
  262. $flow_info = M('fissionbonus_flow')->where( array('id' => $trans_id) )->find();
  263. //type
  264. if( $flow_info['type'] != 1)
  265. {
  266. //send_member_id
  267. $t_info = M('member')->where( array('member_id' => $flow_info['send_member_id']) )->find();
  268. $val['tip'] = '(好友'.$t_info['uname'].'帮忙签到)';
  269. }
  270. }
  271. $list[$key] = $val;
  272. }
  273. return array(
  274. 'empty'=>'<tr><td colspan="20">~~暂无数据</td></tr>',
  275. 'list'=>$list,
  276. 'page'=>$show
  277. );
  278. }
  279. public function show_member_down_page($search)
  280. {
  281. $member_model = D('Home/Member');
  282. if($search['type'] == 1)
  283. {
  284. $sql="select m.*,a.telephone as tel from ".C('DB_PREFIX')."member as m left join ".C('DB_PREFIX')."address as a
  285. on m .member_id = a.member_id where 1 ";
  286. $sql .= " and m.share_id = ".$search['member_id']."";
  287. $sql .= " group by m.member_id";
  288. $count=count(M()->query($sql));
  289. $Page = new \Think\Page($count,C('BACK_PAGE_NUM'));
  290. $show = $Page->show();// 分页显示输出
  291. $sql.=' order by m.member_id asc LIMIT '.$Page->firstRow.','.$Page->listRows;
  292. $list=M()->query($sql);
  293. }else if( $search['type'] ==2 ){
  294. $sql = 'select member_id from '.C('DB_PREFIX')."member
  295. where share_id = ".$search['member_id'];
  296. $first_list = M()->query($sql);
  297. $list = array();
  298. if( !empty($first_list) )
  299. {
  300. $ids_arr = array();
  301. foreach( $first_list as $val )
  302. {
  303. $ids_arr[] = $val['member_id'];
  304. }
  305. $ids_str = implode(',', $ids_arr);
  306. $sql="select m.*,a.telephone as tel from ".C('DB_PREFIX')."member as m left join ".C('DB_PREFIX')."address as a
  307. on m .member_id = a.member_id where 1 ";
  308. $sql .= " and m.share_id in (".$ids_str.")";
  309. $sql .= " group by m.member_id";
  310. $count=count(M()->query($sql));
  311. $Page = new \Think\Page($count,C('BACK_PAGE_NUM'));
  312. $show = $Page->show();// 分页显示输出
  313. $sql.=' order by m.member_id asc LIMIT '.$Page->firstRow.','.$Page->listRows;
  314. $list=M()->query($sql);
  315. }
  316. } else if( $search['type'] == 3 ){
  317. $sql = 'select member_id from '.C('DB_PREFIX')."member
  318. where share_id = ".$search['member_id'];
  319. $first_list = M()->query($sql);
  320. $list = array();
  321. if( !empty($first_list) )
  322. {
  323. $ids_arr = array();
  324. foreach( $first_list as $val )
  325. {
  326. $ids_arr[] = $val['member_id'];
  327. }
  328. $ids_str = implode(',', $ids_arr);
  329. $sql = 'select member_id from '.C('DB_PREFIX')."member
  330. where share_id in (".$ids_str.") ";
  331. $second_list = M()->query($sql);
  332. if( !empty($second_list) )
  333. {
  334. $ids_arr = array();
  335. foreach( $second_list as $val )
  336. {
  337. $ids_arr[] = $val['member_id'];
  338. }
  339. $ids_str = implode(',', $ids_arr);
  340. $sql="select m.*,a.telephone as tel from ".C('DB_PREFIX')."member as m left join ".C('DB_PREFIX')."address as a
  341. on m .member_id = a.member_id where 1 ";
  342. $sql .= " and m.share_id in (".$ids_str.")";
  343. $sql .= " group by m.member_id";
  344. $count=count(M()->query($sql));
  345. $Page = new \Think\Page($count,C('BACK_PAGE_NUM'));
  346. $show = $Page->show();// 分页显示输出
  347. $sql.=' order by m.member_id asc LIMIT '.$Page->firstRow.','.$Page->listRows;
  348. $list=M()->query($sql);
  349. }
  350. }
  351. }
  352. foreach($list as $key => $val)
  353. {
  354. //comsiss_flag
  355. if($val['comsiss_flag'] == 1)
  356. {
  357. $member_commiss = M('member_commiss')->where( array('member_id' => $val['member_id'] ) )->find();
  358. $total_wait_where = array();
  359. $total_wait_where['member_id'] = $val['member_id'];
  360. $total_wait_where['state'] = 0;
  361. $total_wait_commiss = $member_model->sum_member_commiss($total_wait_where);
  362. $all_commiss_money = $total_wait_commiss + $member_commiss['money'] +$member_commiss['getmoney']+$member_commiss['dongmoney'];
  363. $member_commiss['all_commiss_money'] = $all_commiss_money;
  364. $member_commiss['wait_money'] = $total_wait_commiss;
  365. $val['member_commiss'] = $member_commiss;
  366. }
  367. $list[$key] = $val;
  368. }
  369. return array(
  370. 'empty'=>'<tr><td colspan="20">~~暂无数据</td></tr>',
  371. 'list'=>$list,
  372. 'page'=>$show
  373. );
  374. }
  375. public function show_jiamember_page($search){
  376. $sql="select * from ".C('DB_PREFIX')."jiauser where 1 ";
  377. if(isset($search['name'])){
  378. $sql.=" and username like '%".$search['name']."%'";
  379. }
  380. $count=count(M()->query($sql));
  381. $Page = new \Think\Page($count,C('BACK_PAGE_NUM'));
  382. $show = $Page->show();// 分页显示输出
  383. $sql.=' order by id desc LIMIT '.$Page->firstRow.','.$Page->listRows;
  384. $list=M()->query($sql);
  385. return array(
  386. 'empty'=>'<tr><td colspan="20">~~暂无数据</td></tr>',
  387. 'list'=>$list,
  388. 'page'=>$show
  389. );
  390. }
  391. public function show_applymembercomiss_page($search){
  392. $sql="select m.uname,m.member_id,m.create_time,txo.state as state,txo.addtime,txo.money,txo.id from ".C('DB_PREFIX')."member as m,".C('DB_PREFIX')."tixian_order as txo where m.member_id = txo.member_id ";
  393. if(isset($search['name'])){
  394. $sql.=" and m.uname like '%".$search['name']."%'";
  395. }
  396. if(isset($search['email'])){
  397. $sql.=" and m.email='".$search['email']."'";
  398. }
  399. if(isset($search['tel'])){
  400. $sql.=" and m.telephone='".$search['tel']."'";
  401. }
  402. $count=count(M()->query($sql));
  403. $Page = new \Think\Page($count,C('BACK_PAGE_NUM'));
  404. $show = $Page->show();// 分页显示输出
  405. $sql.=' order by txo.state asc, txo.addtime desc LIMIT '.$Page->firstRow.','.$Page->listRows;
  406. $list=M()->query($sql);
  407. return array(
  408. 'empty'=>'<tr><td colspan="20">~~暂无数据</td></tr>',
  409. 'list'=>$list,
  410. 'page'=>$show
  411. );
  412. }
  413. public function show_fen_applymembercomiss_page($search){
  414. $sql="select m.uname,m.member_id,m.create_time,txo.state as state,txo.addtime,txo.money,txo.id from
  415. ".C('DB_PREFIX')."member as m,".C('DB_PREFIX')."fen_tixian_order as txo where m.member_id = txo.member_id ";
  416. if(isset($search['name'])){
  417. $sql.=" and m.uname like '%".$search['name']."%'";
  418. }
  419. if(isset($search['email'])){
  420. $sql.=" and m.email='".$search['email']."'";
  421. }
  422. if(isset($search['tel'])){
  423. $sql.=" and m.telephone='".$search['tel']."'";
  424. }
  425. $count=count(M()->query($sql));
  426. $Page = new \Think\Page($count,C('BACK_PAGE_NUM'));
  427. $show = $Page->show();// 分页显示输出
  428. $sql.=' order by txo.state asc, txo.addtime desc LIMIT '.$Page->firstRow.','.$Page->listRows;
  429. $list=M()->query($sql);
  430. return array(
  431. 'empty'=>'<tr><td colspan="20">~~暂无数据</td></tr>',
  432. 'list'=>$list,
  433. 'page'=>$show
  434. );
  435. }
  436. public function show_applymember_page($search){
  437. $sql="select m.uname,m.member_id,m.create_time,mc.state as state,mc.addtime,mc.id from ".C('DB_PREFIX')."member as m,".C('DB_PREFIX')."member_commiss_apply as mc where 1 and m.member_id = mc.member_id and mc.state =0 ";
  438. if(isset($search['name'])){
  439. $sql.=" and m.uname like '%".$search['name']."%'";
  440. }
  441. if(isset($search['email'])){
  442. $sql.=" and m.email='".$search['email']."'";
  443. }
  444. if(isset($search['tel'])){
  445. $sql.=" and m.telephone='".$search['tel']."'";
  446. }
  447. $count=count(M()->query($sql));
  448. $Page = new \Think\Page($count,C('BACK_PAGE_NUM'));
  449. $show = $Page->show();// 分页显示输出
  450. $sql.=' order by mc.state asc, mc.addtime desc LIMIT '.$Page->firstRow.','.$Page->listRows;
  451. $list=M()->query($sql);
  452. return array(
  453. 'empty'=>'<tr><td colspan="20">~~暂无数据</td></tr>',
  454. 'list'=>$list,
  455. 'page'=>$show
  456. );
  457. }
  458. function add_member($data){
  459. if(empty($data['uname'])){
  460. $error="用户名不能为空!!";
  461. }elseif(M('Member')->getByUname(trim($data['uname']))){
  462. $error="用户名已经存在!!";
  463. }elseif(empty($data['email'])){
  464. $error="邮箱不能为空!!";
  465. }elseif(M('Member')->getByEmail($data['email'])){
  466. $error="邮箱已经存在!!";
  467. }elseif(empty($data['pwd'])){
  468. $error="密码不能为空!!";
  469. }
  470. if($error){
  471. return array(
  472. 'status'=>'back',
  473. 'message'=>$error
  474. );
  475. }
  476. $data['pwd'] =think_ucenter_encrypt($data['pwd'],C('PWD_KEY'));
  477. $data['create_time'] =time();
  478. $data['status'] =1;
  479. if(M('member')->add($data)){
  480. return array(
  481. 'status'=>'success',
  482. 'message'=>'新增成功',
  483. 'jump'=>U('Member/index')
  484. );
  485. }else{
  486. return array(
  487. 'status'=>'back',
  488. 'message'=>'新增失败'
  489. );
  490. }
  491. }
  492. function info($id){
  493. $member=M('member')->find($id);
  494. $address=M('address')->where(array('member_id'=>$id))->select();
  495. return array(
  496. 'info'=>$member,
  497. 'address'=>$address
  498. );
  499. }
  500. function edit_info($d){
  501. $data=$d;
  502. if(empty($d['pwd']))
  503. {
  504. unset($data['pwd']);
  505. }else{
  506. $data['pwd']=think_ucenter_encrypt($d['pwd'],C('PWD_KEY'));
  507. }
  508. $integral_model = D('Seller/Integral');
  509. $member_info = M('member')->field('score')->where(array('member_id'=>$d['member_id']))->find();
  510. if($d['score'] != $member_info['score'])
  511. {
  512. $del_score = $d['score'] - $member_info['score'];
  513. if($del_score < 0)
  514. {
  515. //系统扣除 system_add system_del
  516. //
  517. $integral_model->charge_member_score($d['member_id'], -$del_score,'out', 'system_del');
  518. }else{
  519. //系统奖励
  520. //$integral_model->charge_member_score( $member_id, $score,$in_out, $type, $order_id=0)
  521. $integral_model->charge_member_score($d['member_id'], $del_score,'in', 'system_add');
  522. }
  523. }
  524. unset($d['score']);
  525. $r=M('member')->where(array('member_id'=>$d['member_id']))->save($data);
  526. $http_refer = cookie('http_refer');
  527. if(empty($http_refer))
  528. {
  529. $http_refer = U('Member/index');
  530. }
  531. return array(
  532. 'status'=>'success',
  533. 'message'=>'修改成功',
  534. 'jump'=>$http_refer
  535. );
  536. }
  537. }
  538. ?>