| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- <?php
- namespace app\common\model;
- class OrderProductModel extends BaseModel
- {
- protected $table = 'erp_order_product';
- protected function genSchema(array $schema)
- {
- // TODO: Implement genSchema() method.
- }
- /**
- * @param $o_id
- * @return OrderProductModel[]|array|\think\Collection
- * @throws \think\db\exception\DataNotFoundException
- * @throws \think\db\exception\DbException
- * @throws \think\db\exception\ModelNotFoundException
- */
- public function findByOrderId($o_id) {
- return $this->where('is_delete', 0)
- ->where('order_id',$o_id)
- ->select();
- }
- /**
- * @param $c_id
- * @param int $is_upload_numerology
- * @param int $is_upload
- * @return int
- * @throws \think\db\exception\DbException
- */
- public function countByCustomerId($c_id, $is_upload_numerology = 1, $is_upload = null) {
- $where = [
- ['is_delete', '=', 0],
- ['customer_id', '=', $c_id],
- ['is_upload_numerology', '=', $is_upload_numerology]
- ];
- if ($is_upload) {
- array_push($where,['is_upload', '=', $is_upload]);
- }
- return $this->where($where)
- ->count();
- }
- }
|