onlineUserId = $onlineUserId; $this->onlineEnterpriseId = $onlineEnterpriseId; $this->objDOrderCoupon = new DOrderCoupon('default'); self::orderCouponSubTable($onlineEnterpriseId, $onlineUserId); } /** * 优惠券分表 * @param $enterpriseId (企业id) * @param $userId (用户id) * @throws \Exception */ public function orderCouponSubTable($enterpriseId, $userId) { $tableName = $this->objDOrderCoupon->getTableName($this->objDOrderCoupon->get_Table() . '_' . $enterpriseId, $userId, $this->cutTable); $this->objDOrderCoupon->setTable($tableName); } /** * 添加订单优惠信息 * @param $params * @return ResultWrapper * @throws \Exception */ public function addOrderCoupon($params,$multiple = false) { $dbResult = $this->objDOrderCoupon->insert($params, $multiple); if ($dbResult === false) { return ResultWrapper::fail($this->objDOrderCoupon->error(), ErrorCode::$dberror); } return ResultWrapper::success($dbResult); } /** * 通过订单id,获取订单优惠信息 * @param $selectParams ['orderId'=>[1,2,3]] * @return ResultWrapper */ public function getCouponByOrderIds($selectParams) { $dbResult = $this->objDOrderCoupon->select($selectParams, '*'); if ($dbResult === false) { return ResultWrapper::fail($this->objDOrderCoupon->error(), ErrorCode::$dberror); } else { return ResultWrapper::success($dbResult); } } }