merchant.model.php 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. <?php
  2. defined('InShopNC') or exit('Access Invalid!');
  3. class merchantModel extends Model
  4. {
  5. public function getMerchant($mchid)
  6. {
  7. return $this->table('merchant')->where(['mchid' => $mchid])->select();
  8. }
  9. public function addMerchant($insert){
  10. return $this->table('merchant')->insert($insert);
  11. }
  12. public function getMerchantInfo($condition, $field = '*')
  13. {
  14. $result = $this->table('merchant')->where($condition)->field($field)->find();
  15. return $result;
  16. }
  17. public function getMerchantList($condition, $page = null, $order = '', $field = '*', $limit = '')
  18. {
  19. $result = $this->table('merchant,member')->join('inner')->on('member.member_id=merchant.admin_id')
  20. ->field($field)->where($condition)->order($order)->limit($limit)->page($page)->select();
  21. return $result;
  22. }
  23. public function getPrices($mchid, $amount,$quality)
  24. {
  25. return $this->table('merchant_price')->where(['mchid' => $mchid, 'spec' => $amount , 'quality' => $quality])->select();
  26. }
  27. public function delPrices($condition){
  28. return $this->table('merchant_price')->where($condition)->delete();
  29. }
  30. public function insertPrices($params){
  31. return $this->table('merchant_price')->insertAll($params);
  32. }
  33. public function editMerchant($update, $condition)
  34. {
  35. return $this->table('merchant')->where($condition)->update($update);
  36. }
  37. public function getPdlog($condition, $pagesize = '', $field = '*', $order = '', $limit = '')
  38. {
  39. $pdlog = $this->table('pd_log')->field($field)->where($condition)->page($pagesize)->order($order)->limit($limit)->select();
  40. if (empty($pdlog)) return [];
  41. return $pdlog;
  42. }
  43. public function addRefillEvidence($params)
  44. {
  45. return $this->table('refill_evidence')->insert($params);
  46. }
  47. public function getRefillEvidence($condition, $pagesize = '', $field = '*', $order = '', $limit = '')
  48. {
  49. $list = $this->table('refill_evidence,member')->join('inner')->on('member.member_id=refill_evidence.member_id')->field($field)->where($condition)->page($pagesize)->order($order)->limit($limit)->select();
  50. if (empty($list)) return [];
  51. return $list;
  52. }
  53. public function getRefillEvidenceInfo($condition, $field = '*')
  54. {
  55. $result = $this->table('refill_evidence,member')->join('inner')->on('member.member_id=refill_evidence.member_id')->where($condition)->field($field)->find();
  56. return $result;
  57. }
  58. public function editRefillEvidence($condition , $update)
  59. {
  60. return $this->table('refill_evidence')->where($condition)->update($update);
  61. }
  62. }