|
@@ -5,6 +5,7 @@ namespace app\common\model;
|
|
|
use app\admin\model\AdminMoneyLog;
|
|
|
use app\common\service\UserSvc;
|
|
|
use Carbon\Carbon;
|
|
|
+use think\Db;
|
|
|
use think\db\Query;
|
|
|
use think\Model;
|
|
|
use Yansongda\Supports\Arr;
|
|
@@ -30,6 +31,7 @@ use Yansongda\Supports\Arr;
|
|
|
* @property float amount_pay
|
|
|
* @property float amount_coupon
|
|
|
* @method static static payed()
|
|
|
+ * @method static static hasRefund()
|
|
|
* @method static static statusPay()
|
|
|
* @method Query hasGoods($goods_id)
|
|
|
*/
|
|
@@ -338,6 +340,11 @@ class Orders extends Model
|
|
|
OrderInfo::whereRaw("orders.id=order_info.order_id and order_info.goods_id={$goods_id}")->buildSql()
|
|
|
);
|
|
|
}
|
|
|
+ public function scopeHasRefund(Query $query){
|
|
|
+ $query->whereExists(
|
|
|
+ OrderInfo::where('refund_id','>',0)->where('order_info.order_id',Db::raw('orders.id'));
|
|
|
+ );
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|