Tixian.php 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <?php
  2. namespace Bill\Lib;
  3. use Dever;
  4. class Tixian
  5. {
  6. public function up($mid, $ycash, $cash, $name, $bank, $bankname, $card,$sign)
  7. {
  8. $member = Dever::db('agent/member')->find(array('id' => $mid, 'clear' => true));
  9. if ($member['status'] <= 2) {
  10. $cash = -1*$cash;
  11. $ycash = -1*$ycash;
  12. $data['mid'] = $mid;
  13. $data['order_num'] = $this->getOrderId();
  14. $data['yue'] = $member['cash'] + $ycash;
  15. $data['ycash'] = $ycash;
  16. $data['cash'] = $cash;
  17. $data['name'] = $name;
  18. $data['bank'] = $bank;
  19. $data['bankname'] = $bankname;
  20. $data['card'] = $card;
  21. $data['sign'] = $sign;
  22. $data['status'] = 1;
  23. return Dever::db('bill/tixian')->insert($data);
  24. }
  25. return false;
  26. }
  27. /**
  28. * 生成订单号
  29. *
  30. * @return mixed
  31. */
  32. public function getOrderId()
  33. {
  34. $where['order_num'] = Dever::order('C');
  35. $state = Dever::db('bill/cash')->one($where);
  36. if (!$state) {
  37. return $where['order_num'];
  38. } else {
  39. return $this->getOrderId();
  40. }
  41. }
  42. }