Pbargainorder.php 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. <?php
  2. /**
  3. * 砍价订单辅助,用于判断砍价订单是归属于哪一个团长的
  4. *
  5. */
  6. namespace app\common\model;
  7. use think\facade\Db;
  8. /**
  9. * ============================================================================
  10. *
  11. * ============================================================================
  12. * 版权所有 2014-2028 浙江惠利玛产业互联网有限公司,并保留所有权利。
  13. * 网站地址: https://www.valimart.net/
  14. * ----------------------------------------------------------------------------
  15. *
  16. * ============================================================================
  17. * 数据层模型
  18. */
  19. class Pbargainorder extends BaseModel {
  20. public $page_info;
  21. public $lock=false;
  22. const PINTUANORDER_STATE_CLOSE = 0;
  23. const PINTUANORDER_STATE_NORMAL = 1;
  24. const PINTUANORDER_STATE_SUCCESS = 2;
  25. const PINTUANORDER_STATE_FAIL = 3;
  26. private $bargainorder_state_array = array(
  27. self::PINTUANORDER_STATE_CLOSE => '砍价取消',
  28. self::PINTUANORDER_STATE_NORMAL => '砍价中',
  29. self::PINTUANORDER_STATE_SUCCESS => '砍价成功',
  30. self::PINTUANORDER_STATE_FAIL => '砍价失败'
  31. );
  32. /**
  33. * 获取砍价订单表列表
  34. * @access public
  35. * @author csdeshang
  36. * @param type $condition 条件
  37. * @return type
  38. */
  39. public function getPbargainorderList($condition,$pagesize='') {
  40. $res = Db::name('pbargainorder')->where($condition)->order('bargainorder_id desc');
  41. if($this->lock){
  42. $res=$res->lock(true);
  43. }
  44. if($pagesize){
  45. $res=$res->paginate(['list_rows'=>$pagesize,'query' => request()->param()],false);
  46. $pbargainorder_list = $res->items();
  47. $this->page_info = $res;
  48. }else{
  49. $pbargainorder_list=$res->select()->toArray();
  50. }
  51. return $pbargainorder_list;
  52. }
  53. /**
  54. * 获取砍价订单表列表
  55. * @access public
  56. * @author csdeshang
  57. * @param type $condition 条件
  58. * @return type
  59. */
  60. public function getOnePbargainorder($condition,$lock=false) {
  61. return Db::name('pbargainorder')->where($condition)->lock($lock)->find();
  62. }
  63. /**
  64. * 获取砍价订单表数量
  65. * @access public
  66. * @author csdeshang
  67. * @param type $condition 条件
  68. * @return type
  69. */
  70. public function getPbargainorderCount($condition) {
  71. return Db::name('pbargainorder')->where($condition)->count();
  72. }
  73. /**
  74. * 增加砍价订单
  75. * @access public
  76. * @author csdeshang
  77. * @param type $data 参数内容
  78. * @return type
  79. */
  80. public function addPbargainorder($data) {
  81. return Db::name('pbargainorder')->insertGetId($data);
  82. }
  83. /**
  84. * 编辑砍价订单
  85. * @access public
  86. * @author csdeshang
  87. * @param type $condition 条件
  88. * @param type $data 数据
  89. * @return type
  90. */
  91. public function editPbargainorder($condition, $data) {
  92. return Db::name('pbargainorder')->where($condition)->update($data);
  93. }
  94. /**
  95. * 砍价状态数组
  96. * @access public
  97. * @author csdeshang
  98. * @return type
  99. */
  100. public function getBargainorderStateArray() {
  101. return $this->bargainorder_state_array;
  102. }
  103. }