ProductTemplateModel.php 606 B

12345678910111213141516171819202122232425
  1. <?php
  2. /**
  3. * Author: luzheng.liu
  4. * Time: 2021/6/7 17:18
  5. */
  6. namespace app\api\model;
  7. use app\common\until\Until;
  8. class ProductTemplateModel extends BaseModel {
  9. protected $table = 'product_template';
  10. public function getTemplateProductInfo(int $templateId) {
  11. $rs = $this->alias('pt')
  12. ->field('p.*,pt.price realPrice,pt.template_id,pt.product_id')
  13. ->join('product p', 'p.id = pt.product_id')
  14. ->where([['p.status','=', ProductModel::NORMAL],['pt.template_id','=',$templateId]])
  15. ->select();
  16. return Until::modelToArray($rs);
  17. }
  18. }