You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

60 lines
1.5 KiB

  1. <?php
  2. //Author:fuhc
  3. //Date:20161010
  4. //供应商
  5. require_once "Api/ApiBase.php";
  6. require_once "Lib/Common/SupplierAction.class.php";
  7. class Supplier extends ApiBase{
  8. function getHotelSupplierList(){
  9. $supplierobj = new SupplierAction;
  10. $supplierList=$supplierobj->getHotelSupplierList();
  11. $data['code']=$supplierList['code'];
  12. $data['info']=$supplierList['info'];
  13. $data['supplier_list']=$supplierList['supplier_list'];
  14. return $data;
  15. }
  16. function getPurchaseNameBySupplier(){
  17. $supplier_id=isset($_POST['supplier_id'])?$_POST['supplier_id']:(isset($_GET['supplier_id'])?$_GET['supplier_id']:""); // 不为空
  18. if(empty($supplier_id) && $supplier_id!="0"){
  19. $data['code']="16";
  20. $data['info']="错误的请求参数";
  21. return $data;
  22. }
  23. $supplierobj = new SupplierAction;
  24. $purchaseNames=$supplierobj->getPurchaseNameBySupplier($supplier_id);
  25. $data['code']=$purchaseNames['code'];
  26. $data['info']=$purchaseNames['info'];
  27. if($data['code']!="0"){
  28. return $data;
  29. }
  30. $data['purchase_people_list']=$purchaseNames['purchase_people_list'];
  31. return $data;
  32. }
  33. }
  34. $op=isset($_POST['op'])?$_POST['op']:(isset($_GET['op'])?$_GET['op']:""); // 不为空
  35. $data=array();
  36. $data['code']="0";
  37. $data['info']="";
  38. if(empty($op)){
  39. $data['code']="5";
  40. $data['info']="op操作参数异常";
  41. echo json_encode($data);
  42. exit();
  43. }
  44. $obj=new Supplier;
  45. if($op=="selsupplier"){
  46. $data=$obj->getHotelSupplierList();
  47. }else if($op=="selpurchase"){
  48. $data=$obj->getPurchaseNameBySupplier();
  49. }
  50. echo json_encode($data);